ruby-2.0

Undefined method 'to_h' on Ruby array

北慕城南 提交于 2020-01-24 02:09:05
问题 As per Ruby Array documentation, there is a method to_h which can be used to convert arrays to hash as long as each element of the array is another array of two elements. Example below from the same documentation p [[:foo, :bar], [1, 2]].to_h However, when I run the above code, I get this error: irb(main):001:0> p [[:foo, :bar], [1, 2]].to_h NoMethodError: undefined method `to_h' for [[:foo, :bar], [1, 2]]:Array from (irb):1 from E:/RubyInstall/bin/irb:12:in `<main>' irb(main):002:0> My Ruby

Cannot load files using require

可紊 提交于 2020-01-23 12:05:48
问题 I just downloaded Ruby 2.0 and have a serious problem with require when I try to run a simple Sinatra app: /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- sinatra (LoadError) from /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from test.rb:1:in `<main>' Also, this and other programs I have a problem with now, worked perfectly fine

Cannot load files using require

試著忘記壹切 提交于 2020-01-23 12:05:22
问题 I just downloaded Ruby 2.0 and have a serious problem with require when I try to run a simple Sinatra app: /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- sinatra (LoadError) from /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from test.rb:1:in `<main>' Also, this and other programs I have a problem with now, worked perfectly fine

Cannot load files using require

人盡茶涼 提交于 2020-01-23 12:05:14
问题 I just downloaded Ruby 2.0 and have a serious problem with require when I try to run a simple Sinatra app: /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- sinatra (LoadError) from /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from test.rb:1:in `<main>' Also, this and other programs I have a problem with now, worked perfectly fine

Get the Size of Multiple Tables in One Query POSTGRES?

夙愿已清 提交于 2020-01-06 12:52:08
问题 Following on from this prior question about relation sizes: This query: query = "CREATE TEMPORARY TABLE query_out AS SELECT * FROM users WHERE is_admin = false" ActiveRecord::Base.connection.execute(query) will generate a temporary table and insert all the records from this query i.e SELECT * FROM users WHERE is_admin = false then ActiveRecord::Base.connection.execute("SELECT pg_size_pretty(pg_relation_size('query_out'))") I am only getting the the size of one table. What doI need to do so

Rails 4 and Ruby 2 Net/HTTP SSL Request: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

江枫思渺然 提交于 2020-01-04 04:36:04
问题 This is nearly a duplicate of: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed but specific to a Rails 4 and Ruby 2 environment. I figure it is appropriate to make a new question because the solutions that worked on my machine for previous environments no longer appear to work after the updates to Rails and Ruby. The Problem When making a Net/HTTP SSL request to the tune of: api_uri = URI("http://accounts.google.com/o/oauth2/token") https = Net:

Rails 4.0 install error -require: cannot load such file — active_support (LoadError)

て烟熏妆下的殇ゞ 提交于 2020-01-03 21:46:07
问题 I installed the new Ruby (2.0) and Rails 4.0 and when i do "Rails new test_app" i get the following. Anybody run into this? [devuser@devbox ~]$ rails new test_app /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': cannot load such >file -- active_support (LoadError) from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require' from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/generators.rb:4:in > <top (required)>' from /usr

Cannot run Unicorn with Ruby 2.0

。_饼干妹妹 提交于 2020-01-02 05:40:43
问题 On my ubuntu machine, I can run unicorn on ruby 1.9.3, however, it does not seem to work with ruby 2.0. Any idea why? root@dev:/home/karan# rvm use 1.9 Using /usr/local/rvm/gems/ruby-1.9.3-p429 root@dev:/home/karan# unicorn -v unicorn v4.6.3 root@dev:/home/karan# rvm use 2.0 Using /usr/local/rvm/gems/ruby-2.0.0-p195 root@dev:/home/karan# unicorn -v /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file --

Possible to get Rails 4 working on Windows?

£可爱£侵袭症+ 提交于 2019-12-29 04:48:07
问题 I'm working on a Rails 4 (using the release candidate) project and now need to collaborate with someone on a Windows machine. I can't even get a basic webpage to come up, however :(. It was quite a pain even installing sqlite3 using Ruby 2.0. Now, when I try to get a webpage up (I just created a dummy /home/index controller and view), I get this error: Showing C:/Users/me/RubymineProjects/test_project/app/views/layouts/application.html.erb where line #6 raised: (in C:/Ruby200-x64/lib/ruby

Ruby on Rails - “Add 'gem sqlite3'' to your Gemfile”

若如初见. 提交于 2019-12-28 05:51:28
问题 I'm a complete n00b on Rails with only beginner knowledge of Ruby. I plan on studying Ruby more before I really learn Rails, but I'm waayy too curious for my own good. Anyway, I was following the tutorial, but I got stuck when it said to type "rails server" in the blog directory. It states, "Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile." So I quit the server, installed sqlite3, reinstated the server...only to get this message again.