Questions tagged as 'ruby'

2
answers

Asynchronous Process in Ruby on Rails

I have a process that makes a match between the items [books, movies, songs and games] of a certain user on Facebook with the items registered in my database. The problem is that the whole process takes around 18 ~ 25 seconds and I would not w...
asked by 01.06.2014 / 02:59
1
answer

Syntax Error in Ruby: unexpected tCONSTANT, expecting keyword_end

When creating tables I used camelcase to create columns, but to use Ruby on Rails to generate hash, listing the two tables appears error message Code: @testes = Teste.find_by_sql( " SELECT * FROM tabelax INNER JOIN tabelay on tabelay...
asked by 27.04.2018 / 21:10
2
answers

How to simplify the process of classifying a hash based on values

Oops, I'm new to the site, as well as Ruby. My question is: Is there a more efficient way to sort a hash according to values? I made the code below, but I'm sure it's not the most efficient way. agents = {"pedro" => 7, "lucas" => 1...
asked by 07.02.2018 / 20:08
2
answers

How to update Gem on windows?

My problem is that I can not update the gem I downloaded rubyInstaller I tried to run the command to update: gem update rails --no-document But unfortunately does not update gives the error: gem update rails --no-document...
asked by 03.11.2016 / 14:34
1
answer

In the ActiveRecord is it mandatory to use belongs_to?

Is it mandatory that, for an association between two models, I have belongs_to and has_one ? Or is it possible to only use has_one/has_many between the two models, when not necessarily none of the models belong to any other?...
asked by 07.08.2017 / 04:43
1
answer

Column-specific selection in an HTML table in JS

Hello! I'm an IT student and I'm learning about Rails. I have the following HTML table of a view: <p id="notice"><%= notice %></p> <h1>Produtos</h1> <table class="table table-hover custom" id="tabelaProduto"&...
asked by 29.05.2017 / 21:21
2
answers

How to send commands to the ruby interpreter from a Shell Script?

This is more out of curiosity ... I've seen some examples of what I want to do, but in Perl. I tried to find a way to do the same in ruby, but to no avail. I want a function to generate an MD5 hash from a word passed as an argument. The inten...
asked by 04.07.2016 / 04:03
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

Force SSL in Rails

Let's say you use your browser to interact with the camera on your computer or notebook in some way. This will only happen through an SSL connection, because browsers reject the permission to access the camera if it is not through SSL How do...
asked by 16.09.2016 / 21:23
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