ruby-1.9.2

Installing Gems without rvm, as root, with explicit version of ruby

坚强是说给别人听的谎言 提交于 2019-11-29 08:57:37
I've decided to get rid of rvm, and I'm having trouble compiling a gem with my new version of ruby 1.9.2. The gem requires 1.9.2, I have it, yet says it can't install without, so the error messages makes no sense. How can I explicitly tell the gem to compile with said version of ruby? Gem::InstallError: linecache19 requires Ruby version >= 1.9.2. An error occured while installing linecache19 (0.5.12), and Bundler cannot continue. Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling. apps2 ~/projects/sms/apps2/apps2_admin $ ruby -v ruby 1.9.2p180 (2011-02-18 revision

collection_select method gives error in Rails 3.1.1

给你一囗甜甜゛ 提交于 2019-11-29 06:35:14
I have a Model called Category and other Model Product. They have has_many and belongs_to relation. But code in my view <p><%= f.collection_select(:product, :category_id, Category.all, :id, :name)%> is giving me undefined method `merge' for :name:Symbol Any clue what is wrong with it? Chances are you have something like this: <%= form_for @product do |f| %> Because f is already tied to product , you don't need to include it as your first argument, so it should just be: <%= f.collection_select :category_id, Category.all, :id, :name %> Or, you could not use f. : <%= collection_select :product,

Make Ruby 1.9 regard all source files to be UTF-8 encoded. (Even if recompiling the interpreter is necessary)

≡放荡痞女 提交于 2019-11-28 16:52:34
问题 I want to port a rails app from Ruby 1.8.7 to 1.9.2. Some of the files contain umlauts like ä/ö/ü both within strings and comments. The files were saved as UTF-8 but without a BOM (byte order mark) at the beginning. As you might know, Ruby 1.9 refuses to parse these files, giving an invalid multibyte char (US-ASCII) I was googling and reading a lot but the only solution to this seems to be to insert a BOM or insert # coding: utf-8 at the beginning of each file. My editor of choice (gEdit)

Installing linecache19 for Ruby 1.9.2 via rvm

 ̄綄美尐妖づ 提交于 2019-11-28 05:55:50
I am having a problem with installing linecache19(dependency of ruby-debug19) for ruby 1.9.2 Here is my term output $ rvm use 1.9.2 Using /home/bogdan/.rvm/gems/ruby-1.9.2-p180 $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ rvm exec gem install linecache19 --backtrace gem install linecache19 --backtrace rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/] ERROR: Error installing linecache19: linecache19 requires Ruby version >= 1.9.2. ERROR: Error installing linecache19: linecache19 requires Ruby version >= 1.9.2. Building native

Installing Gems without rvm, as root, with explicit version of ruby

ぐ巨炮叔叔 提交于 2019-11-28 02:19:29
问题 I've decided to get rid of rvm, and I'm having trouble compiling a gem with my new version of ruby 1.9.2. The gem requires 1.9.2, I have it, yet says it can't install without, so the error messages makes no sense. How can I explicitly tell the gem to compile with said version of ruby? Gem::InstallError: linecache19 requires Ruby version >= 1.9.2. An error occured while installing linecache19 (0.5.12), and Bundler cannot continue. Make sure that `gem install linecache19 -v '0.5.12'` succeeds

How to set default Ruby version with RVM?

谁说我不能喝 提交于 2019-11-27 18:20:35
Ubuntu 11. I do the following: $ rvm --default use 1.9.2 and I get: Using /home/md/.rvm/gems/ruby-1.9.2-p180 so that is good. but when I now open a new terminal window I still get: $ ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] If you put the RVM source line in your bashrc (in order to ensure that non-interactive shells have access to RVM), you will need to source .bashrc from your .bash_profile with the following as the last lines in your .bash_profile if [ -f "$HOME/.bashrc" ]; then source $HOME/.bashrc fi This pre-supposes that you have [[ -s "$HOME/.rvm/scripts/rvm" ]] &&

Thread Safety: Class Variables in Ruby

跟風遠走 提交于 2019-11-27 17:59:37
Performing writes/reads on class variables in Ruby is not thread safe. Performing writes/reads on instance variables appears to be thread safe. That said, is it thread safe to perform write/reads on instance variables of a class or metaclass object? What are the differences between these three (contrived) examples in terms of thread safety? EXAMPLE 1: MUTUAL EXCLUSION class BestUser # (singleton class) @@instance_lock = Mutex.new # Memoize instance def self.instance @@instance_lock.synchronize do @@instance ||= best end end end EXAMPLE 2: INSTANCE VARIABLE STORAGE class BestUser # (singleton

Get list of a class' instance methods

天大地大妈咪最大 提交于 2019-11-27 06:19:58
I have a class: class TestClass def method1 end def method2 end def method3 end end How can I get a list of my methods in this class ( method1 , method2 , method3 )? You actually want TestClass.instance_methods , unless you're interested in what TestClass itself can do. class TestClass def method1 end def method2 end def method3 end end TestClass.methods.grep(/method1/) # => [] TestClass.instance_methods.grep(/method1/) # => ["method1"] TestClass.methods.grep(/new/) # => ["new"] Or you can call methods (not instance_methods ) on the object: test_object = TestClass.new test_object.methods.grep(

Installing linecache19 for Ruby 1.9.2 via rvm

为君一笑 提交于 2019-11-27 05:37:21
问题 I am having a problem with installing linecache19(dependency of ruby-debug19) for ruby 1.9.2 Here is my term output $ rvm use 1.9.2 Using /home/bogdan/.rvm/gems/ruby-1.9.2-p180 $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ rvm exec gem install linecache19 --backtrace gem install linecache19 --backtrace rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/] ERROR: Error installing linecache19: linecache19 requires Ruby version >= 1.9.2.

Invalid gemspec because of the date format in specification

▼魔方 西西 提交于 2019-11-26 21:17:16
When I include a gem that I made, thanks to Bundler (version 1.0.12), in a Gemfile and then I try to bundle or to rake just like that: $ rake I've got this error message: Invalid gemspec in [/Users/zagzag/.rvm/gems/ruby-1.9.2-p180@foobar/specifications/myplugin-1.0.0.gemspec]: invalid date format in specification: "2011-04-21 00:00:00.000000000Z" I'm on the last Mac OS X (10.6.4), with: $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.4.0] and: $ gem -v Invalid gemspec in [/Users/zagzag/.rvm/gems/ruby-1.9.2-p180@foobar/specifications/myplugin-1.0.0.gemspec]: invalid date