Questions tagged as 'ruby'

1
answer

Filter result of a collection_select based on the selection of another

I need to filter the result of neighborhoods based on the selection of a city. I have a has_many relation through the active record. Is it possible to perform this filter without submitting? In models: class Cidade < ApplicationRecord...
asked by 09.09.2017 / 20:12
1
answer

Questions about relationships in Rails "field must exists"

Good morning, I started to study rails recently and whenever I define the relationships between the entities in my database, some doubts arise. The first time, I created and defined relationships in migrations. I did this: class CreatePr...
asked by 27.07.2017 / 15:42
2
answers

Jquery does not run on the first page load!

Hello, I have a page where the first loading of Jquery does not run, refreshing the page (refresh, F5) the function written in JQuery works. I'm using JQuery with Ruby On Rails technology. Solutions: Add script at the end of HTM...
asked by 13.06.2017 / 14:32
1
answer

Is Gems from Ruby or On Rails?

I'm starting in Ruby and On Rails. I was a bit confused about "gem", is it part of Ruby or Rails? Example command below. gem install nome gema     
asked by 12.05.2017 / 15:04
1
answer

Metaprogramming with ruby on rails in a partial

I'm working on a Ruby on Rails project and I'm working on a module (Financial) it's linked to several models, and depending on the screen the user is able to do it bring a screen with all the financial movements of that object. However I wanted...
asked by 10.06.2017 / 22:40
1
answer

undefined method 'id' for nil: NilClass

I'm a beginner in ruby, and I had this error ... def new @section = Section.new({:page_id => @page.id, :name => "Default"}) @pages = @page.subject.pages.sorted @section_count = Section.count + 1 end It says the problem...
asked by 28.03.2017 / 10:46
1
answer

Comparison __FILE__ and $ 0

Recently I saw this decision making in a ruby code: if __FILE__ == $0 .... Then I had to print __FILE__ and $0 separately on irb and I saw that the two pass the same information, my doubts are: Why (when) do this comp...
asked by 28.01.2017 / 03:02
1
answer

Query with select and find in rails

Hello, I wanted to do a find with select from just a few fields in rails, but it is giving error, but if I do with where it works normally, does anyone know if it is possible to use select with find? Ex: @organization = Organization.find(actual...
asked by 07.12.2016 / 11:32
2
answers

Error starting Http server in Ruby

Hello everyone, I'm new to Ruby and I'm trying to create my first project but when I start the server with the command rails server I get this error: João@joao-note MINGW64 ~/Documents/Desenvolvimento/Rails/Primeiro_Projeto/hello (maste...
asked by 13.12.2016 / 21:45
1
answer

Remote: true error using in RAILS, for POST of a JS file

I have a problem with my code, I want Rails to remote: true from "Login" with a class and an id as below, but the server passes a GET, but I want it to look in the controller format.js to send a POST type JS function, I need to know if the code...
asked by 11.11.2016 / 22:23