Questions tagged [ruby-2.1]

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

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Ruby 2.1 was released on Dec 25, 2013.

For information on Ruby in general, visit .

222 questions
0
votes
0 answers

Completed 401 Unauthorized Error after ruby upgrade(to 2.1.3)

GemFile has gem 'dm-rails', '~> 1.2.1' gem 'devise', "2.0.4" gem 'dm-devise', "2.0.1" Errors Redirected to http://localhost:3000/ Completed 302 Found in 263ms Started GET "/" for 127.0.0.1 at 2015-03-03 20:59:33 +0530 Processing by…
Temerario
  • 53
  • 1
  • 9
0
votes
1 answer

Forms with routes in Rails 4.1

Rails 4.1, reaching the driver knowing edit and use _form.html.erb again. I tried to do the following:   <% = Form_for @user, :controller => "admin/users" do | f |%> <% end %> #Controller …
0
votes
1 answer

IPv4 address expects 4 bytes but 1 bytes error when gem install

I got IPv4 address expects 4 bytes but 1 bytes error when I try to gem install Here is my gem env: RUBYGEMS VERSION: 2.3.0 RUBY VERSION: 1.9.3 (2014-11-13 patchlevel 551) [i386-mingw32] Anyone know how to solved this? Thanks!
0
votes
2 answers

Scaffold generated Sum of all Integers

This is driving me nuts with loads of undeclared variables. I have created a simple scaffold with text and integers. How to sum up all integers? See image: I only want to sum up the "Watts". Im using Rails 4; Ruby 2.1.3 I get this: undefined method…
Sylar
  • 11,422
  • 25
  • 93
  • 166
0
votes
1 answer

what is the meaning of online: true option?

I found a code in stackoverflow. def after_sign_up_or_signin_path_for(resource) resource.update_all(online: true) dashboard_url end since this question should not be asked in stackoverflow, but I googled and researched for hours, but…
roarfromror
  • 276
  • 1
  • 2
  • 11
0
votes
2 answers

Why do certain Time comparisons have counterintuitive results?

In Ruby 2.1.2, I can successfully compare the result of Time.parse and Time.utc for the same time, and it returns the expected true: Time.parse("2015-02-09T22:38:43Z") == Time.utc(2015, 2, 9, 22, 38, 43) => true However, this same comparison…
eirikir
  • 3,802
  • 3
  • 21
  • 39
0
votes
0 answers

Rails postgres best way to optimize query - to populate a calendar view

I want to construct a calendar full month view that looks like this (simplistically): user 1 2 3 4 5 6 7 8 9 10 ... user one X X X user two X X X Where 1..31 across the top is the…
Craig McGuff
  • 3,968
  • 6
  • 30
  • 35
0
votes
5 answers

String with comma-separated values and newlines: split values and create arrays for each newline

I have a string like this (from a form submission): "apple, banana\r\ncherries\r\n\r\ngrapes, blue berries \r\n\r\n \r\norange" How do I detect values AND create an array for each line that has text? Like this: [ ["apple", "banana"], …
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232
0
votes
0 answers

No route matches [GET] error bluehost

I know this is some basic stuff but i'm not sure why i'm getting this type of error.it's driving me nuts.we moved our site to bluehost from site5 ,i did all the config setting there but i'm getting No route matches [GET] error. link :…
Akki209
  • 123
  • 12
0
votes
1 answer

How to put a selected value in rails form?

Here is my haml code: -if params[:product_id] =select_tag 'product', options_from_collection_for_select(Product.all, :id, :name), placeholder: "Product", required: true, value:…
Charlon
  • 363
  • 2
  • 16
0
votes
1 answer

Shoulda context and syntax, ruby 2.1

The following code doesn't compile in ruby 2.1 on OS X. The error message is quite strange: /Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb:10:in `require': …
jayunit100
  • 17,388
  • 22
  • 92
  • 167
0
votes
0 answers

What is the double colon before module names in Ruby stand for?

I see in a lot of Ruby source code a double colon before module names, I wonder what is that all about? Here is an example from a Ruby Gem called Conductor: https://github.com/rails/conductor/blob/master/lib/conductor/engine.rb#L7
Wazery
  • 15,394
  • 19
  • 63
  • 95
0
votes
0 answers

Rails attr_accessor not being changed at all using Ruby 2.1.4

I have a Session class to store the currently logged user. It's something like that: class Session attr_reader :user, :ip, :gef attr_accessor :branchid def initialize(user, ip, gef=nil) (...) end (...) end Then I have a controller…
Rodrigo Castro
  • 1,573
  • 14
  • 38
0
votes
2 answers

Parse data from JavaScript of retrieved page

I'm retrieving a web page with OpenURI: require 'open-uri' page = open('http://www.example.com').read.scrub Now I'd like to parse the values of the attributes playerurl, playerdata and pageurl of the retrieved page. They appear in a