According to your own experience is it better to use client-side validations? Because if we analyze, Rails, in the standard validations, sends the request, does the validation and then returns the errors. This process, although not time consumi...
I saw a few days ago, some information about the Crystal language, but I would like to understand a little better about the main differences with Ruby.
Examples:
Which is faster and lighter in processing?
Can everything done in Ruby be...
I'm starting with Ruby and I came across the following code:
user_input = gets.chomp
user_input.donwcase!
My question is why to use the exclamation point after the downcase.
In this other question here I asked about :symbols and 'strings' and found that using :symbols optimizes memory usage by the application.
My question is whether the same is true for creating hashes:
hash = {:indice =&...
The data validation parameters of the Ruby on Rails Framework use values with : before and after the word.
validates :terms_of_service, acceptance: { accept: true, message: 'Mensagem de Validação' }
validates :city, presence: true
H...
Ruby objects have a method called send that we can call methods dynamically.
class MyClass
private
def true_method?
true
end
end
Example:
mc = MyClass.new
mc.send(:true_method?)
mc.__send__(:true_method?)
Why do you...
Is there a ready-made function that converts strings into camel cases for strings separated by underscores?
I would like something like this:
"CamelCaseString".to_underscore
return "camel_case_string" .
def initialize(nome = "Anônimo", salario = 0.0)
@nome = nome
@salario = salario
end
To make it clear, what I can not understand is the difference between whether or not to use this method in a class and for what purpose it is eventually us...
Problem: I have to get the object that displays the content in the English language (lang == en)
But depending on the search the order of the languages comes completely different and I tried to create a loop obj.take['http://dbpedia....
I'd like to have the items in an array shuffled. Something like this:
[1,2,3,4].scramble => [2,1,3,4]
[1,2,3,4].scramble => [3,1,2,4]
[1,2,3,4].scramble => [4,2,3,1]
and so on, randomly. How to do?