Questions tagged as 'ruby'

2
answers

Redirecting in Ruby on Rails

I am new to Ruby on Rails and would like to know how I can do to redirect from the% share% action to the% share%. I would like the page "show.html.erb" to be displayed after saving the article created from the page "new.html.erb" .     
asked by 08.11.2016 / 01:52
1
answer

Ruby on rails 4: Render and / or redirect called multiple times in action. using Devise

in my controller registrations_controller.rb in the update method, when you edit and make the changes it does not redirect me to the path I want but it flags me the error: DoubleRenderError Render and / or redirect were called multiple times in...
asked by 17.08.2016 / 19:38
2
answers

Error searching for records by id with friendly_id

I do this in my functions edit, update, destroy @post = Post.friendly.find(params[:id]) if @post.user_id == current_user.id There is some way to optimize and make a single function, before doing it this way: before_action :set_user_post,...
asked by 13.08.2016 / 20:45
1
answer

Validate request_time and delivery_time to be greater than 24 hours, with different models

From the current time, I need to validate that it is greater than 24 hours: hora_pedido is start time. hora_entrega is final time. From the parent model, there is an attribute called hora_pedido ; model: class Re...
asked by 08.06.2017 / 16:44
1
answer

Vagrant + Chef error

I have a centos instance mounted with vagrant but I am having problems to be able to provision git and composer. Let's see if you can throw me a cable. config.vm.provision "chef_solo" do |chef| chef.cookbooks_path = "cookbooks"...
asked by 14.04.2016 / 15:31
1
answer

syntax error, unexpected keyword_ensure, waiting at the end of the Ruby And Rails entry

Good afternoon Community, I come with this problem from Ruby & Rails I'm a bit of a rookie in the language and this mistake has me dismayed, The error comes to me in the path app/views/bienvenida/index.html.haml:20 assuming that th...
asked by 06.01.2016 / 23:43
1
answer

When should self be used in a Model in Rails?

Within a Model , when I have a variable write operation in a method, why do I need to add self to work correctly? For example, if I have the following code: class Zombie < ActiveRecord::Base beffore_save :make_rotting d...
asked by 25.01.2017 / 19:54
2
answers

Handle date and time with Ruby on Rails

At this moment I am developing my web application, which has competitions. These competitions have, among others, these two fields: -deadline, datetime -finished, booblean First of all, I need to know how I can do so that the user can c...
asked by 15.07.2017 / 12:36
1
answer

render related data

I'm using a query to search for records, I have two tables, one is "sale" and the other is "detallevet" (this refers to the details of the sale) by this query I proceed to do the search of the sales in its corresponding model: def self.busqu...
asked by 28.12.2016 / 16:25
4
answers

How to pass javascript variables to ruby on rails?

What I want to achieve is that when a user clicks on my menu that is on a part of my page this same one appears but on another part of my website. Function of my menu title <div id="TituloMenu" > <%= image_tag "menu2.png" , :cl...
asked by 19.12.2016 / 22:26