Questions tagged as 'ruby-on-rails'

1
answer

Association belongs_to inside serializer is not returning anything

The application contains a module called Dispute , this module contains Procedures , each Procedure contains a user and belongs to a dispute. As described below, belongs_to is not displayed and the :user attribute i...
asked by 02.01.2017 / 22:06
1
answer

How to redirect to the same position of the object after the update

I'm displaying a collection of random objects in my action index. However, the objects are displayed one at a time. So: @objects = Object.order("RANDOM()").limit(1) In the view index, I can send a comment to this object, but when I submit t...
asked by 06.12.2016 / 23:10
0
answers

Why is the timestamp field in the firebird database shown differently in a Ruby on Rails application?

I have a legacy Firebird 2.5 database. Access it via IBExpert 2016.9.4.1 This database is part of a request management system that is being migrated from a Delphi 10.1 Update 2 application to a Ruby(2.3.3) on Rails(4.2.7....
asked by 06.12.2016 / 18:27
0
answers

How to apply serializer to an object generated by FactoryGirl?

I have an object user generated by FactoryGirl like the one below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email } pa...
asked by 22.11.2016 / 13:07
1
answer

Load constant

I'm having trouble for instance the Report model. Console: LoadError (Unable to autoload constant Report_questao, expected app/models/report.rb to define it): app/controllers/pessoas_controller.rb:49:in 'reportar' controller: require...
asked by 21.11.2016 / 10:30
0
answers

Catch the value of a select_tag and put in a variable

I want to get the value of this select_tag and put it in the link_to message <%= select_tag(:testee, options_for_select(CloneDatabaseController.find_all_models)) %> <%= link_to('Click here', controller: 'clone_database', action: 'sho...
asked by 13.12.2016 / 20:45
1
answer

Id Id form button

I have a button to submit a form <div class="actions"> <%= f.submit, html: {class: "button"}%> </div> But none of the HTML attributes ( class and id ) work, they only give me an error on the page. Does an...
asked by 16.12.2016 / 18:06
1
answer

Problem with validates in Rails 4

I have a situation that I can not understand what is wrong. I have a validation in the model that by the console it works correctly, but when running by the browser the form does the submit and ignores the validation. My Model: class User <...
asked by 15.11.2016 / 22:02
0
answers

JS only works by refreshing the page

Click the button: <td><%= link_to 'simulacao', simulacao_path(simulado) %></td> <%= form_tag('/correcao', method: :get, remote: true) %> <%= button_tag 'Corrigir', class:'btn btn-primary btn-lg' %>...
asked by 08.10.2016 / 17:32
1
answer

Select state city rails4

I have a dynamic select of states and cities and my idea is to list the state capital first selected. I have the following code to list the cities but that is not listing the capital first: @cidades = Cidade.where("estado_id = ?", Estado.fi...
asked by 07.11.2016 / 03:45