Questions tagged as 'ruby'

1
answer

Calculation of Factorial in Ruby

Create a Ruby script that reads 10 integers and stores them in an array. Then, the script must calculate the factorial of each of these 10 numbers, and store the results in another array, and print the values. I can not hit the factorial and...
asked by 13.05.2018 / 00:38
1
answer

Ruby rails beginner [closed]

How do I create a program where I use my name and outputs with a greeting?     
asked by 16.02.2018 / 14:31
2
answers

How to make an HTTP request in Ruby?

How do I make an HTTP request in Ruby? I need to implement an API, and for this it is necessary to make a REST request for such a URL, how do I POST such a request?     
asked by 22.12.2017 / 19:24
1
answer

Calculate the elapsed time after creating a record

I would like to know how to calculate the time between creating a record (created_at) and the current time . My intention is to show this difference in seconds, minutes, hours, or days that this occurred. Is there a gem / method to accomplish...
asked by 13.12.2017 / 21:07
1
answer

Algorithm to validate CNH

Hello, I need to validate CNH in Ruby, but I do not find any code and no reference to the validation rule. Does anyone have any of this information? Thank you     
asked by 11.01.2018 / 20:10
1
answer

Error installing gem pg

I'm having this error while running bundle install    "An error occurred while installing pg (0.21.0), and Bundler can not continue.   Make sure that 'gem install pg -v' 0.21.0 '' succeeds before bundling.   In Gemfile: " This is th...
asked by 05.12.2017 / 01:53
1
answer

Error in summing the iteration of an array

I started in ruby these days and I have a question. I was doing the HackerRank exercises and in a certain exercise it was necessary to do the sum of the elements of the array, simple not? Yes. But my ruby code had an error message: def sum(n,...
asked by 29.10.2017 / 00:18
1
answer

Symbols in rails

After creating a template in rails can you change the created symbol? For example I created a template called transaction, rails creates in the plural transactions but would like to change that name for transactions is possible?     
asked by 29.09.2017 / 02:18
1
answer

Show User Logged in rails_admin dashboard

Good afternoon everyone, I am developing a project in rails 5 using devise, cancancan and rails_admin, what happens is the following, I created some types of users, among them I mention admin users (has full manager permission on cancancan), and...
asked by 06.10.2017 / 18:23
1
answer

Testing in RSpec failing because of DatabaseCleaner

I was having trouble with tests about 4 days ago. At first I had a problem with "database is locked" and the file where DatabaseCleaner is configured; I changed two lines that used :transaction to :truncation and solved th...
asked by 21.08.2017 / 15:30