Questions tagged as 'ruby'

1
answer

Rails, Plugin or gem?

Good morning, I am currently seeing how to create modules in rails to create microservices and modular apps. I have reviewed a blog where it teaches how to create a modular app in rails link After viewing the blog, the following question ar...
asked by 30.12.2017 / 13:42
1
answer

How can I validate two attributes in a rails model?

Good afternoon friends of stackoverflow. I have the following model, which is a weak table from many to many, in which I want to validate two attributes that do not repeat themselves within the table, for example: I have groups and activit...
asked by 26.01.2018 / 20:01
2
answers

How often do you have to make a migration in RAILS?

In the guides and tutorials says that when you create a model, you create a migration that you then execute with rake db:migrate . But in what other cases do you have to create a migration and execute it? When you change the model, d...
asked by 16.01.2018 / 09:07
1
answer

best process and loop in Ruby with a random

I need to store a random number within a variable cycle of an indeterminate total of a list, I have as input parameters, the total of the list and the cycle. This is the code that I programmed and I know it's over elaborated, and that's the poin...
asked by 29.09.2017 / 15:19
1
answer

Assign roles in an intranet

Good morning, I am currently developing an intranet with different tools, I am using devise and cancan to assign roles to users, however I have a problem which is that the same user will have a different role in each tool of the intranet so you...
asked by 12.10.2017 / 16:31
1
answer

Put a string variable as a hash in another string variable

I have a string variable nombre = ‘juan’ And I want to put it as hash in another variable Todos = ( { "nombre" => ‘juan’ }) "The line above is what I want to know how to do it" And every time the variable name changes, for exam...
asked by 16.09.2017 / 15:02
1
answer

best process and loop in Ruby

I need to do a cycle within another cycle, from a total number of iterations and number of iterations per cycle, it occurred to me to do it in for and it works, I could also do it in while, but I suspect that it is not the best process. especial...
asked by 28.09.2017 / 20:17
1
answer

Connection with a Firebird database

Good morning, my doubt arises because I can not find a gem or how to use a database of firebird 2.5 in ruby 2.3.0 and rails 5.0.0.1 I want to create an alternative connection since by default it used a mysql database, but I need to insert, up...
asked by 01.09.2017 / 20:46
1
answer

record nil after post

I want to edit a record with an action in the controller but when the record is passed, nil arrives and of course I can not edit it. Attached the driver, the model and the view. You can see the code on GitHub (it's a very basic code...
asked by 23.06.2017 / 20:21
1
answer

Update total stock of products

I am trying to create a stock from the new products that are created with the System Purchases. All Compras have a ItemCompra , with a certain product_id and product.quantity , these are nested using a accepts_nested_attribut...
asked by 19.06.2017 / 14:36