ruby-2.0

Heroku postgres not found

白昼怎懂夜的黑 提交于 2019-12-13 14:28:11
问题 When I go to my Apps in Heroku and check the resources I can see Postgresql but when I run from my computer pg:info I get the following: $ heroku pg:info ! Resource not found or this: $ heroku pg:wait ! Resource not found although when I run pg:credential I do get an output: $ heroku pg:credentials HEROKU_POSTGRESQL_PINK Connection info string: "dbname=some_name host=ec2-107-22-165-15.compute-1.amazonaws.com port=5432 user=some_user password=some_password sslmode=require" I have tried running

Are refinements in Ruby 2.0 totally useless? [closed]

一笑奈何 提交于 2019-12-13 10:42:33
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . There were so-called refinements introduced in Ruby 2.0. I was playing with them and now I’m totally cajoled: — The main declared

wxWidgets (wxRuby) with Ruby 2.0

独自空忆成欢 提交于 2019-12-13 04:24:22
问题 I'm looking for an Win32 wxRuby gem for Ruby 2.0, does someone know where to find it? I didn't have success trying to build it and it seems the project is dead. 回答1: Latest ruby version which supports wxruby gem is 1.9.1 (gem is named wxruby-ruby19, gem named wxruby is dedicated for ruby 1.8) and wxruby project is no longer developed. So if you need to use ruby 2.0 you are on your own now. But try to ask at http://www.ruby-forum.com/forum/wxruby where some of former wxruby developers are

Unable to create rails application due to errors

泪湿孤枕 提交于 2019-12-12 05:07:36
问题 Here is what I'm doing and getting rails new ffffff /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [activemodel-4.0.0.beta1, activesupport-4.0.0.beta1, atomic-1.0.1, backports-3.1.1, bcrypt-ruby-3.0.1, bson-1.8.3, bson_ext-1.8.3, builder-3.1.4, bundler-1.3.1, chunky_png-1.2.7, coderay-1.0.9, compass-0.12.2, daemons-1.1.9, eventmachine-1.0.3, exceptional-2.0.33, fssm-0.2.10, haml-4.0.0, i18n-0.6.4, jsmin-1.0.1, mail-2.5.3, method_source-0.8

Specify Character Encoding for Net::HTTP

牧云@^-^@ 提交于 2019-12-12 04:56:06
问题 When I make this HTTP request: Net::HTTP.get_response('www.telize.com',"/geoip/190.88.39.27").body => "{\"timezone\":\"America\\/Curacao\",\"isp\":\"United Telecommunication Services (UTS)\",\"country\":\"Cura\xE7ao\",\"dma_code\":\"0\",\"region_code\":\"00\",\"area_code\":\"0\",\"ip\":\"190.88.39.27\",\"asn\":\"AS11081\",\"continent_code\":\"NA\",\"city\":\"Willemstad\",\"longitude\":-68.9167,\"latitude\":12.1,\"country_code\":\"CW\",\"country_code3\":\"CUW\"}\n" It returns a JSON body, but

Can Can selectively cache abilities

限于喜欢 提交于 2019-12-11 20:22:38
问题 I know about caching the whole current_ability . Something like def current_ability cached_ability = Rails.cache.read("#{current_user.cache_key}::ability") if cached_ability.present? ability = Marshal.load( cached_ability ) else ability = super Rails.cache.write("#{current_user.cache_key}::ability", Marshal.dump( ability )) end @current_ability = ability end But is there is a way to cache a single ability ? for example I do this : Rails.cache.fetch("#{user.cache_key}::comments::ability") do

rspec's .should fails (outside describe/it block) in Ruby 2?

瘦欲@ 提交于 2019-12-11 03:54:35
问题 In Ruby 2, with gem rspec 2.14.1 (Ubuntu's most recent), with Rails not installed, why does this fail? require 'rubygems' require 'rspec' 3 .should == 3 NoMethodError: undefined method `should' for 3:Fixnum I've relied for years on the convenient idiom x .should == y . https://www.relishapp.com/rspec/rspec-expectations/v/2-14/docs/syntax-configuration and https://www.relishapp.com/rspec/rspec-expectations/docs/syntax-configuration say that this syntax is still supported by default. Edit:

Ruby 2.0.0 cannot load such file even though gem is installed

懵懂的女人 提交于 2019-12-11 03:28:53
问题 I've tried all of the other solutions people have talked about on here, but none of them have helped / applied. I've written a Ruby script that requires the spreadsheet gem. The requiring works fine when I execute the script normally with ruby myscript.rb , but after running chmod +x myscript.rb , and then trying to run the program with ./myscript.rb I get the following error.... /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45

ubuntu 12.04 ruby 2.0 rails: Could not find 'thread_safe'

非 Y 不嫁゛ 提交于 2019-12-10 23:40:59
问题 im installing rails on ubuntu 12.04. installed manualy, using this method: How do I install ruby 2.0.0 correctly on Ubuntu 12.04? then: gem update --system gem install rails now if i run command "rails" the output is as following: /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'thread_safe' (~> 0.1) - did find: [thread_safe-0.1.2-java] (Gem::LoadError) from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1265:in `block in activate

Can procs be used with case statements in Ruby 2.0?

99封情书 提交于 2019-12-09 15:43:55
问题 I remember something about procs being allowed in case statements in Ruby 2.0, but I can't google it. I tried checking Ruby 2.0.0 NEWS and How to write a switch statement in Ruby. I also visited http://ruby-doc.org , but the link it had for keywords was for Ruby 1.9, not Ruby 2.0. Are procs allowed in case statements? 回答1: Yes. 2.0.0p0 :001> lamb = ->(x){ x%2==1 } #=> #<Proc:0x007fdd6a97dd90@(irb):1 (lambda)> 2.0.0p0 :002> case 3; when lamb then p(:yay); end :yay #=> :yay 2.0.0p0 :003> lamb =