Questions tagged as 'ruby'

1
answer

What does arroba (@) mean in variables in Ruby?

What does at (@) mean in front of variables in Ruby? For example @s = gets.to_i     
asked by 13.08.2018 / 16:50
1
answer

working with decimal {5,2} rails

I created my first API in Rails, and I'm using a simple template with to create a basic Crud, I managed to put my application to work I created the GET method cute little returned 200, only that in my POST it is returning the following error in...
asked by 29.01.2018 / 03:45
1
answer

Operator and Ruby

I would like this code to take two numbers and display the divisible numbers for the first, the second, and the two. But I was not able to make use of the current AND for this case, because the array div_pelos2 returns empty. def self.divisive...
asked by 12.10.2017 / 21:11
1
answer

Login Help [Ruby On Rails - Gem Devise]

I'm using Gem Devise to create a login system. However, my project requires 2 login verification fields instead of just 1. For example, the company has 5 departments, the user has the code 0010 and works in department 1, so for his login he woul...
asked by 17.08.2017 / 13:48
2
answers

Doubt Gem Devise

Hello, I'm using gem devise for a project of its own and a question has arisen, how do I leave just one free route, for example I want all other routes to need login and password minus the main page. I did some research and got to this li...
asked by 23.10.2017 / 02:48
2
answers

Rails + Materialize Select field

Diplomats, I have the following problem: <div class="input-field"> <%= f.label :kind_id %> <%= collection_select(:contact, :kind_id, @kind_options_for_select, :id, :description, class: 'input-field') %> </div&g...
asked by 09.03.2017 / 14:48
2
answers

Counter in model

I'm looking for a way to add a variable with increment to add to the id of a div, could anyone tell me the most recommended way to do this? My difficulty in making this increment is due to cocoon that is used to call this render <%= li...
asked by 09.12.2016 / 14:27
2
answers

Where is my error in this Ruby code?

I'm having trouble with methods with parameter passing, the code runs, but it buga when I step to var within one method and receive as parameter in another. I'm new to Ruby. def player_welcome puts "Seja bem vindo ao Jogo de Adivinhação !!...
asked by 14.10.2016 / 01:47
1
answer

Query in ActiveRecord

I have this relationship . How do I query on ActiveRecord to return data for Works , WorkZei and Wi_schools ? I've tried it like this: r = Responsible.find(1) students = r.students students.each {|s| s.scho...
asked by 04.05.2016 / 22:57
1
answer

How to upload file via ajax with Rails 4?

I want to download a pdf file to process on my controller and then return it as it gets rendered in the backend , I would like a loading bar or circle to appear. However, I'm having trouble sending the file asynchronously. How do I send an asyn...
asked by 02.08.2016 / 06:03