Questions tagged as 'rails4'

2
answers

Enable CORS in api rails

Using this GEM to enable CORS my application. The code I have in my config/application.rb is as follows: config.middleware.insert_before 0, 'Rack::Cors' do allow do origins 'http://localhost:8080' resource '*',...
asked by 02.06.2015 / 15:44
1
answer

How to execute JavaScript function on current page through Application Controller?

I'm doing a browser validation (IE < 10) through the Application Controller with gem "browser" . I need any JavaScript page with a message saying that browser is not recommended for any page of the application that is accessed. A...
asked by 10.06.2015 / 15:31
0
answers

nested attributes through

I own 3 models: class Day < ApplicationRecord belongs_to :goal has_many :day_salesmen, dependent: :destroy has_many :salesmen, through: :day_salesmen validates_presence_of :date_day, :goal_id accepts_nested_attributes_for :day_sa...
asked by 31.10.2017 / 23:14
1
answer

Rails 4 Error each_with_index when using activerecord-import

I'm trying to import an app into Rails 4, using the gem activerecord-import . When I try to run the command: Detail.import( columns, values, :validate => false ,:timestamps => false ) I get an error like this: **NoMethodEr...
asked by 01.06.2016 / 18:10
1
answer

How do I make many-to-many relationship in Ruby on Rails with has and belongs to many?

I have a system table and a table category, a system has many categories and a category has several systems, I wanted to use the has_and_belongs_to_many option of Rails (for being a simple interface and even to learn how to use this feature). Bu...
asked by 26.09.2016 / 15:58
3
answers

Application ruby on rails

Is it possible to change the state of a rails application, from production to test? with the possibility of going back to production again     
asked by 17.01.2018 / 12:30
2
answers

How to select record by position

Can you tell me how I can select a record by position? How would you search for Maria's record? obs: do not search by id or name I found the take in the guide, but it looks for the first and the position. ex: Person.take(3) // ele pegari...
asked by 02.12.2016 / 13:33
3
answers

Views specific to Devise

In my project I'm using Rails 5.1.1 and Devise to login. My question is how can I make a View, so that Devise uses it as a layout, other than application.html.erb ?     
asked by 26.06.2017 / 21:25
1
answer

Register two separate models in one

Today I come with another question, but about code. Next, I am making a system to register students and courses and a screen to register classes where part of the register is to select students and courses to register the class. I did the follow...
asked by 25.04.2016 / 01:14
1
answer

Make searches using repetitions

I created the following method to search random people for a certain party, the problem is that if I want to add another ten people from another party it does not add, it only replaces the search with no party to such party class Pessoa < A...
asked by 02.10.2016 / 16:48