Questions tagged as 'ruby'

1
answer

How do I create an array from my array, that with .select create an array with the elements that begin with the letter p?

I have the following array: nombres = ["Violeta", "Andino", "Clemente", "Javiera", "Paula", "Pia", "Ray"] a = nombres.select{ |ele|} I would like to know what would be the instruction to create in the variable a a array differ...
asked by 04.05.2018 / 19:25
1
answer

Write in a text file the result of a command in Ruby

I am trying to write the result of a command in a text file but I can not write anything. This is my code f directorio2 == nil directorio2 = 'pwd' directorio2 = directorio2.to_s end puts "#{directorio2}" system "diff -rs #{directorio1...
asked by 03.05.2018 / 14:06
1
answer

Variable or method not defined in Ruby How do I solve it with metaprogramming?

Good that such, I am tried to define a behavior to the Person Class: What I need to do is that by placing the "transactional" within the body of the class dynamically I include a mixin to the class or execute some method. I understand t...
asked by 04.11.2017 / 18:12
1
answer

How to access server images from your Rails url

I want to access an image that I have in assets/images/images.jpg or public/images/imagen.jpg from my server in production, example: http://miservidor.com/images/imagen.jpg and have my image.     
asked by 09.07.2017 / 02:45
1
answer

Correct use of flash [: success]

Good afternoon, I need your help. I need to show a success or rejection message, once I have inserted an object in BD. So far I have only managed to update the browser window, not automatically (as it should be), once the event submit has b...
asked by 31.07.2017 / 20:57
1
answer

Rails. Delayed_job works two hours apart

I am implementing automation tasks to send emails at a specific time with this gem in the following way: def create @competition = Competition.new(competition_params) if @competition.save @competition.delay(run_at: @competition.s...
asked by 20.07.2017 / 19:22
1
answer

Implement "add to favorites" in Rails 5

I am new to Rails and I need your help to implement a functionality in my web app. It is a web app of recipes and the functionality in question is "Add recipe to Favorites". I call the "User" "Chef". I want a chef to be able to save recipes from...
asked by 20.04.2017 / 21:49
1
answer

Error with data_mapper and json gems

Gem :: Conflict Error: Unable to activate dm-serializer-1.2.2, because json-2.0.2 conflicts with json (~ > 1.6) gem list --local *** LOCAL GEMS *** actioncable (5.1.0) actionmailer (5.1.0) actionpack (5.1.0) actionview (5.1.0) activejob...
asked by 23.05.2017 / 02:28
1
answer

Pass objects collection via link_to

Good morning, how could a collection of objects pass through link_to between views in rails? <%= link_to '<i class="fa fa-arrow-right" aria-hidden="true"></i>'.html_safe, family_group_path(obj), data: {modal: true} %>     
asked by 20.03.2017 / 14:07
1
answer

Select options in ruby

I would like to know how I can manually enter the options of a select, I have been using the following: <%= f.collection_select :establecimiento_id, Establecimiento.order(:nombre), :id, :nombre, include_blank: true %> but tha...
asked by 09.02.2017 / 15:02