Questions tagged [ruby-2.3]

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

Ruby 2.3.0 was released on on 25 Dec 2015. It is the first stable release of the Ruby 2.3 series.

It introduces some new features (like the safe navigation operator and frozen string literals) and various performance improvements. A description of new features in Ruby 2.3 is at https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/.

This tag is intended for questions specific to version 2.3 of Ruby.

164 questions
0
votes
3 answers

How to use alias with parameters in Ruby?

I would like to refactor this code: class Logger class << self def info title, msg puts hash_for(title, msg, :info ).to_json end def unknown title, msg puts hash_for(title, msg, :unknown).to_json …
B Seven
  • 44,484
  • 66
  • 240
  • 385
0
votes
1 answer

rails dot notation no longer works for accessing hash values gives NoMethodError

I'm using rails 5 with ruby 2.3.3 . Today I added a gem, there was a version conflict so I took the gem out. Since then dot notation such as hash.test no longer works. It gives NoMethodError: private method test called for {:test=>"value"}:Hash How…
monty_lennie
  • 2,871
  • 2
  • 29
  • 49
0
votes
3 answers

Ruby hash access value from string array

I have an hash like below: hash = {"a": [{"c": "d", "e": "f"}] } Normally we can access it like hash["a"][0]["c"]. But, I have a string like: string = "a[0]['c']" (This can change depending upon user input) Is there any easy way to access hash…
Abhishek Jain
  • 238
  • 2
  • 5
0
votes
1 answer

Google::Apis::ServerError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A

I cannot figure out what the issue is here. I have a Rails / ActiveAdmin app that I setup a task for. The task is this wrapped in a rails task. upload.rb require 'google/apis/drive_v3' require 'googleauth' require…
Bot
  • 11,868
  • 11
  • 75
  • 131
0
votes
1 answer

bundle open disqus_api not accessing real source code?

I'm trying out the gem https://github.com/toptal/disqus_api for use on this project, but struggling to get it to accept my auth details. That might end up being a separate question, but for now I wanted to explore the source code and do some manual…
Arepo
  • 825
  • 1
  • 9
  • 23
0
votes
1 answer

LoadError (cannot load such file -- bcrypt)

Is anyone facing this issue: LoadError (cannot load such file -- bcrypt) in a Rails 5 application ? My model is like that: class User < ApplicationRecord validates :name, presence: true, uniqueness: true has_secure_password end I have…
andrefurquin
  • 502
  • 6
  • 17
0
votes
2 answers

How to use same variable across various controllers - ruby on rails

I am using ruby 2.3.1 and rails 3.2.1. I need to initialize a variable called has_sub_menu = false in application controller. In my application i am using more than 30 controllers and only two controllers contains sub-menu, so i need to assign…
user2681579
  • 1,413
  • 2
  • 23
  • 50
0
votes
0 answers

Ruby apply association on each item of collection

I am trying to access specific objects through associations applied one after the other on a collection. For example, one of my database request would be : get_current_user.readable_projects.cards.find(params[:card_id]).tasks get_current_user…
0
votes
2 answers

I have to `bundle install` to every pane of tmux

I'm using tmux for rails project. The purpose is to split pane. Such as, one pane for text editor, one pane for execute rails s -b 0.0.0.0 etc. It was very convenient until now. Every new pane has forgotten that i executed: bundle install So…
dosuken123
  • 438
  • 3
  • 7
  • 19
0
votes
1 answer

Rails - Add row to nested form table via jquery

Problem: Using jquery to dynamically add new row to table. When adding new row, attribute does not increment. I'm having some difficulty getting jquery to work with rails. Full disclosure, I've never been too good with javascript / jquery, however…
nerdgasms
  • 621
  • 5
  • 5
0
votes
1 answer

Rails - strong parameters - string array column - form

String array in form and controller I'm using Rails 5 and Ruby 2.3.1 I'm having trouble figuring out how to have a form allow me to add strings to an array on one of my models with one input field per element in the array. For updating an existing…
Jake Smith
  • 2,332
  • 1
  • 30
  • 68
0
votes
2 answers

Rails server quits right when it starts

I have had this problem for a while but have found no solution. I am building a forums application in rails. I had just finished adding bootstrap and the bootstrap gem to my project. I go to run the server and it exits with a huge error. Here it…
Nareg. C
  • 21
  • 1
  • 5
0
votes
0 answers

Cannot run test cases using rubymine

I am using ruby version 2.3.1 and rubymine version 8.0.1. It shows error like following when I try to run test cases Screenshot1: Run test case using following way Screenshot2: Error when I run test cases
0
votes
3 answers

cannot load such file -- bundler/setup (LoadError) - rails c - was working 10 minutes ago

I have no Idea what has gone wrong here. rails c was working 10 minutes ago perfectly. I loaded into my production environment and for some reason the console didn't recognize one of my database tables. I exited and attempted again a few more times…
Avir94
  • 899
  • 9
  • 19
0
votes
3 answers

ruby parameters returning themselves

I'm running Ruby 2.3.1 x64 on Windows 10 x64. My code: class Credentials attr_reader :username, :password def initialize(username = nil, password = nil) @username = username @password = password get_credentials if…