Questions tagged as 'ruby'

1
answer

How do I get the value of a hash in rails?

I have some checkboxes inside a form in the view, that values are being sent to the controller by params for the index. Obs. I am sending the values of the checkboxes of the view index to itself, I need the values of the checkboxes in a varia...
asked by 12.07.2017 / 05:27
1
answer

How to override devise's "create" method?

Hello, I need to override the devise "create" method to make a certain logic before saving the user. But I do not know the way of stones to make such a change. I already researched google but the examples were not clear to me. I generated...
asked by 26.05.2017 / 16:14
1
answer

Devise multiple login pages!

I'm using Devise to authenticate myself. But I have 3 profile types, and I created it through the command rails g devise MODEL my users (Admim, dev and manager), but Devise created a login page for each type of profile, I would like to un...
asked by 01.06.2017 / 13:18
1
answer

List elements of the has_many: through relationship

I'm creating an application and have a has_many: through relationship in my model. So far so good, it worked without problems, saves, edits and deletes. The problem is that I would like to list all the elements that are in the third table of thi...
asked by 27.05.2017 / 20:25
1
answer

Creating a schedule of appointments in Ruby

I want to create a sort of routine that interleaves time interval Example: 8:00 a.m. to 12:00 a.m. 30 minute interval A sample code class Appointment < ActiveRecord::Base has_many :schedules def advance_time(resource) return...
asked by 03.08.2016 / 21:40
1
answer

Class variable in Java have the same behavior as in Ruby?

In Ruby a class variable that is modified by an object ends up modifying the value of all other objects instead of making a copy of that value. Does this also occur in Java?     
asked by 27.11.2016 / 02:54
2
answers

How to edit and create new record in DB? Ruby on rails

I would like to know how I can do the following situation. I have 2 templates Custo and Custo_Historico all CRUD is already working. But when I want to edit a cost it should always create a new record in the Custo_Historic...
asked by 23.06.2016 / 20:27
1
answer

How to change an attribute in the bank via a button

I'm creating a small college project in Ruby on Rails and I came across a problem: I have a table called Person and another call Tools . People have many tools and each tool is owned by one person. I need to add a resource...
asked by 12.06.2016 / 01:36
1
answer

HEROKU connect to mysql database

I'm doing reverse engineering on a system, and I want to use the same database as the old system. But I am not able to connect the system bank in production with this database. And for being in MYSQL I'm using the mysql2 gem, as follows: herok...
asked by 03.10.2016 / 19:03
2
answers

What is the best way to create a model that has a field that is an integer enum?

What is the best way to create a model that has a field that is an integer enum? ex: rails g model status (I do not know how to report it is an enum nor the data type)     
asked by 27.03.2016 / 16:03