Questions tagged as 'ruby-on-rails'

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

using console

Starting project with vagrant, when using the console, an 'Unable to load pry' message appears below: $ rails c Loading development environment (Rails 4.1.4) => Unable to load pry irb(main):001:0> After this I try to execute. irb(ma...
asked by 15.09.2014 / 18:41
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
2
answers

Truncate text and not show unwanted characters with rails

I am using the truncate function to show part of a text, next to this function I added the function html_safe so that the text does not show unwanted characters. But when the text is greater than the limit I set, length: 150...
asked by 02.06.2016 / 21:17
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
3
answers

Delete the .bashrc, .bash_profile, and .profile files: what are the consequences?

I've been trying to install Ruby and Ruby on Rails through RVM but during the installation process I had some problems. I tried to uninstall RVM through the commands: rvm implode gem uninstall rvm After performing these commands, I...
asked by 27.02.2014 / 23:06
1
answer

How to create code to license my clients monthly?

I need to make a code for use license, for example: My clients pay monthly for use of our system, however these clients have the application installed locally in their companies. I need every month to be validated if the customer paid the...
asked by 17.11.2014 / 17:08
2
answers

How to insert values from a Select field into the database

I am a beginner in Ruby on Rails and I need to add a Select field to the user registry form, so I can add a "Type" to the user to be registered. I want to automatically populate the fields when editing and viewing a user record. I'm implement...
asked by 27.07.2014 / 00:32
2
answers

Two-dimensional array in Ruby

I have the two-dimensional array a = [[1,'a'],[1,'b'],[2,'c'],[2,'d'],[3,'e'],[3,'f'],[4,'g'],[4,'h']] I want to separate the letters in another array b so that it looks like this: [["a","b"], ["c", "d"], ["e", "f"], ["g", "h"]] Wher...
asked by 21.05.2014 / 03:54