Questions tagged as 'ruby'

2
answers

Rails performing request XHR when loading pages

I've noticed that in every page / route exchange, Rails * makes a new request Ajax to fetch this new data (HTML), and thus page exchange. I did a lot of research but the closest I got was to Embedded Ruby ( erb ). If this is really...
asked by 11.07.2016 / 19:51
1
answer

How do I collect a String and use it in an if? [closed]

puts "Tem dinheiro? s/n" x = gets.chomp if x = s puts "Vou viajar" else puts "Não vai ser dessa vez" end     
asked by 29.11.2016 / 17:14
1
answer

Adding values from a column of a Ruby related entity

I'm trying to build an application in Rails. In it I have a resource where the user registers products and sales. The relationship is too many, to pass an array of products to sales I did the following def sale_params params.require(:sale)...
asked by 01.08.2016 / 19:31
4
answers

Select without the id field (RoR)

I'm having a very silly question, I'm doing a system with Ruby on Rails and I need to do a select where the id field does not come, the problem is that this field is always present, for example: Employee.select('nome, email').all The a...
asked by 19.11.2015 / 15:47
2
answers

Go get the various fields to the query

I have this query: @tudo = Isolated.joins("LEFT JOIN resists ON resists.isolated_id = isolateds.id").joins("LEFT JOIN genes ON genes.isolated_id = isolateds.id LEFT JOIN stats ON stats.gene_id = genes.id LEFT JOIN mutations ON mutations.id = s...
asked by 18.04.2015 / 01:10
1
answer

Map Substring Solr

I have the following question, I have the city(name, uf, province) model I'm trying to implement the sunspot search method, but I'm getting by: # modelCity.rb searchable do text :name end # controller City unless params[:search]...
asked by 25.02.2014 / 14:06
1
answer

Limit aggregation per grouped item in mongo

I have a collection composed as follows, but with much more data. { _id: ObjectId("db759d014f70743495ef1000"), tracked_item_origin: "winword", tracked_item_type: "Software", machine_user: "mmm.mmm", organization_id: ObjectId("a91864d...
asked by 20.02.2014 / 16:44
1
answer

What is the best way to add ENUM fields in the Rails 4 model?

I need to reference the numbers in the status field of the database, which are in the form ENUM , with the names of my model . What is the best way to do this? models / item.rb class Item < ActiveRecord::Base # d...
asked by 18.03.2014 / 14:51
1
answer

Create an object with strong parameters in Ruby on Rails

I need to create an object from just a button. I do not pass anything to the method, I just call it through the button. All the data I need to access the controller action I'm using. But I can not insert into the database, because of St...
asked by 31.10.2016 / 07:53
1
answer

Multiple submits calling multiple methods in a single form

Hello! I have a form that contains two buttons, each button, when clicking, takes me to a different method inside the same controller. How do I do what needs to be done? Because I can not. form <%= form_tag (@portabilidade), method: :get...
asked by 16.05.2016 / 15:06