Questions tagged as 'ruby'

1
answer

ActionController :: ParameterMissing in CotizaciónController # create param is missing or the value is empty: quote

The context of the question is as follows: I generated the entity Cotizacions , through scaffold . The corresponding view, model and controller was created: quote_controller.rb , quote.rb and views ( _cotizacion.json.jbuilder...
asked by 29.07.2017 / 18:20
1
answer

Rails. Render a partial within another partial with tabs

In my show.html.erb I have a nav-pills . Each of those " pills " have a tab-panel. Well, within these tabs panel I put text and, until now, I had not tried to render a partial one. The functionality of pills is made...
asked by 29.07.2017 / 00:45
3
answers

How to calculate an hour a and an hour b with time ruby

I'm doing a validation that has to be longer than 4 hours and I do not know how to do it. I have two attributes hora_inicio and hora_final , which belong to Time . In the first validation: def validar_horas if hora_i...
asked by 05.06.2017 / 18:39
1
answer

How to add values obtained from the same field?

I would like to calculate the values of a specific field in my table item_compras create_table "item_compras", force: :cascade do |t| t.integer "cantidad_bidon" t.integer "total_bidones" end I am using accepts_nested_att...
asked by 22.05.2017 / 16:41
1
answer

How to pass a parameter in a link_to Rails

the question is the following, I have a Model called publications, in this model I have an integer attribute called: reason, what I want to do is that before the user accesses the view of the form to create publication there is a previous view w...
asked by 12.05.2017 / 04:12
1
answer

Ajax in ruby on rails, the remote process does not work: true

I have a form on the home page (all created with scaffold), which I would like when I click on the publish button, I will add the publication to the same home via ajax. add remote true to the form = form_for @post, remote: true do |f| e...
asked by 07.06.2017 / 20:50
2
answers

change database for each user

I am developing a multi-company website in which each company has its database and when the user logs in, he will then access the database of the company he is associated with, each user having a record called "empresa .id. " The problem comes w...
asked by 13.04.2017 / 15:36
1
answer

Add corners of a matrix in Ruby

I have a square matrix. Let's say that I set it to 3 and put as data 1 to 9, the corners would be 1, 3, 7, 9. So, I use this code to find and add them: for i in 0..N-1 for j in 0..N-1 if(((i==0) || (i==N-1))&&((j==0) ||...
asked by 18.05.2017 / 02:42
2
answers

Show new registration form devise even when logged in

I'm working with the Gema devise for user authentication in my application, but I have the following doubt, I can create users without breaking into the system, but how do I manage to register them when logged in? (Show me the form) and do not s...
asked by 15.03.2017 / 08:08
1
answer

Compare "id" of two related objects

Maybe the question is simple for you. I use the Bidon and Buy models, which are related, when I show the detail of the drum suppose with ID: 1, in the I am showing the last purchases that are made with that drum, what I can not get is tha...
asked by 26.02.2017 / 08:33