Questions tagged [ruby-2.6]

for issues relating to development in Ruby, version 2.6. If your question applies to Ruby in general, use the tag [ruby].

For issues relating to development in Ruby, version 2.6. If your question applies to Ruby in general, use the tag [ruby].

44 questions
0
votes
1 answer

Left zero number has weird results

I was trying do some sum to numbers and have a number with a very left zero and start to get wired results 142 + 3 = 145 but 0142 + 3 = 101 What is the base number data type for ruby ? ( iam using repl 2.6.3 )
abdoutelb
  • 1,015
  • 1
  • 15
  • 33
0
votes
0 answers

Issue when adding Confirmable in Devise - [ArgumentError - wrong number of arguments (given 0, expected 1)]

I've been setting up Devise Confirmable for my development environment Rails 5.1.7 app. My initializers/devise.rb looks like: Devise.setup do |config| require 'devise/orm/active_record' config.secret_key = '########################' …
0
votes
1 answer

Build paths of edge keys in nested hashes in ruby

I have a nested hash with multiple levels and I want to get all the possible paths of each edge key from the root as dot notation string. For example {a: {m: {b: 2}, c: {d: {e: nil}}}} I would like to produce an array of elements like the one…
Leon
  • 1,262
  • 3
  • 20
  • 41
0
votes
1 answer

Run a block if a condition pass

I want to run this block only a condition is satisfied <% if condition %> <% progressive_render do %> SLOW CODE HERE <% end %> <% end %> IF condition = true SLOW CODE should be runnned wrapped by "progressive_render" IF condition = true…
sparkle
  • 7,530
  • 22
  • 69
  • 131
0
votes
1 answer

What is the difference between "@var ||= 123" and "return @var if defined?(@var); @var = 123"?

I'm using ruby 2.6.5 on my local machine. I also use the same ruby version on heroku machine. However i got weird error on using heroku. if i defined a method like: def current_admin @current_admin ||= 'yana' end It works perfectly on my machine,…
Yana Agun Siswanto
  • 1,932
  • 18
  • 30
0
votes
1 answer

Map with conditions

How can I use #map to hide an attribute if it's nil? Conditions aren't working inside a block, so I tried this: account_info = some_db_request account_info.fields.map do |field| { id: field.id, …
QWD666
  • 129
  • 6
0
votes
2 answers

Error installing Rails 6.0.0: Failed to build gem native extension

I am attempting to install Ruby and Rails for the first time and cannot get Rails v6 to install properly. My machine is Windows 10. I have Ruby 2.6.5p114 and RubyGems 3.0.6. I am attempting to install rails 6.0.0. My terminal shows the installation…
0
votes
1 answer

Composition of functions without arguments: wrong number of arguments (given 1, expected 0)

Ie: [1] pry(main)> @foo = rand => 0.46682153267547954 [6] pry(main)> multiply = -> () {@foo*2} => # [7] pry(main)> (multiply>>multiply).call ArgumentError: wrong number of arguments (given 1, expected…
bbozo
  • 7,075
  • 3
  • 30
  • 56
0
votes
0 answers

Two dimensional array which have CSV::Row object returns different result in ruby 2.3 and ruby 2.6

Two dimensional array has the element which is CSV::Row object like this. [[csv_row_object]] I tried to flatten this array and got different result in ruby 2.3 and 2.6. why different result? # in Ruby 2.6(ruby 2.6.0rc1) [[#
Kouta Osabe
  • 121
  • 1
  • 10
0
votes
2 answers

Ruby 2.6.0 Invalid authenticity token

My code shows "Invalid Authenticity" instead of "missing template". What do I need to change in the program to get the "missing template error"? img1 img2 img3 errorImg A reference to the entire program is here below: link to github resp class…
Sean
  • 3
  • 3
0
votes
0 answers

Error Install Bootstrap-sass (ruby 2.6.0)

I tried to install gem bootstrap-sass, but command show I have problem with ffi. I don't know what my problem? Thank you for your help me. I received this error message when I tried to run gem install bootstrap-sass: $ gem install…
Hokly Leng
  • 43
  • 1
  • 7
-1
votes
1 answer

Code works well in Ruby 2.7 but not in Ruby 2.6.3

I have written a code that has a decorator function in Ruby 2.7. It works well in that version but the same code does not work correctly in Ruby 2.6. If I remove the call for the the decorator i.e., wrapper_function then the code executes in Ruby…
Lax_Sam
  • 1,099
  • 2
  • 14
  • 32
-2
votes
2 answers

Does Rails overwrite ruby's default logger?

I'm writing a multilogger implementation in order to enable my application to log to multiple back ends. The implementation looks like: class MultiLogger < Logger def initialize(loggers = []) @loggers = [] end def add(severity, message,…
Pedro Vinícius
  • 476
  • 6
  • 13
-2
votes
1 answer

Cannot load relative file in Ruby Script

Files are organized as follows: - myScriptProject - solutions.ru - main.ru solution.ru def test_function puts 'Hello World' end main.rb #!/Users/myusername/.rbenv/shims/ruby require './solution' # or require_relative…
Hiro Shaw
  • 385
  • 3
  • 18
1 2
3