Questions tagged as 'ruby-on-rails'

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

RoR - Get the strong controller parameters inside the Application Controller

I'm developing a logging process on my system (Rails 5), more specifically within application controller . This process is being created there so that I can add a before_save to the controllers that I want to record logs. Sin...
asked by 30.10.2017 / 18:30
1
answer

Incorrect return

Good evening, I have a problem when it comes to pulling bank information and show it on the show. Mycodelookslikethis:<%[email protected]|answer|%><divclass="media"> <div class="media-left"> <a href...
asked by 02.08.2016 / 23:15
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
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

Page cache is not expiring

I'm using caches_page in a controller in my rails 4 application. caches_page :index, expires_in: 10.minutes I need to make this controller run again after 10 minutes and generate a new page. When I squeeze this in the production environment...
asked by 25.06.2016 / 02:10
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