ruby-1.9.3

Named parameters in Ruby don't work? [duplicate]

懵懂的女人 提交于 2019-12-14 00:33:50
问题 This question already has answers here : No named parameters in Ruby? (4 answers) Closed 5 years ago . I wonder why named parameters don't work as I expect. def my_method(var1, var2 = 1, var3 = 10) puts var1, var2, var3 end my_method(999, var3 = 123) The output 999 123 10 instead of (at least, as I guess should be): 999 1 123 So, what should I do to use named parameters? P.S. When I use the hash, it's not what I'm looking for yet: def my_method(var1, vars = {var2: 1, var3: 10} ) puts var1,

how to open pop up window table using selenium webdriver?

六眼飞鱼酱① 提交于 2019-12-13 04:15:53
问题 there is text label on a webpage, and I am trying to click on that to open a pop-up window,but not getting opened. here is the HTML code: <td width="40%"> <div id="EmpId.outline"> <input type="hidden" name="EmpId" value="" id="popupEmpId"> <input type="text" name="EmpCode" value="" readonly="readonly" class="textMedium250" id="popupEmpCode" autocomplete="off"> <a href="#f2"><label onclick="checkForPopup('EmpPopupDiv','Select a Emp',640,true,refreshConditionOptions);"> + Search for a Emp<

Devise current_user weird behavior after upgrade to ruby 1.9.3

自古美人都是妖i 提交于 2019-12-13 03:41:40
问题 I have upgraded by project from ree-1.8.7 to 1.9.2p429. I have an attribute in my devise model named silhouette_user_id. In views and occasionally in my ruby code, calling current_user.silhouette_user_id returns a different (and WRONG) value than current_user[:silhouette_user_id] which returns the right value. Though I could search and replace to fix this, I'm worried that other attributes will behave the same way. This is a LARGE project and I really need to determine why this is happening.

YAML, delayed_job : Psych vs Syck. How to make pysch read attr_accessors for a ruby object

回眸只為那壹抹淺笑 提交于 2019-12-12 17:09:41
问题 I'm having problems using delayed_job (3.0.3) with ruby 1.9.3. Previously we were using ruby 1.8.7 which comes with yaml syck parser which read all the attributes that are set for a ruby object (including attr_accessors) but with the upgrade to 1.9.3 the yaml parser was switched to psych (which was re-written) and it doesn't take into account any attributes except those persisted in the database. How can we make psych to take the attr_accessors into account as well. I tried to switch to syck

Cannot spawn application

社会主义新天地 提交于 2019-12-12 10:38:51
问题 I have rvm, passenger, ruby 1.9.3, nginx but I now get this error Cannot spawn application '/path/to/my/app': Could not read from the spawn server: Connection reset by peer (104) I have passenger_root set to the output of passenger-config --root and ruby-1.9.3-p125 for passenger_ruby I did have to do rvmsudo passenger-install-nginx-module because passenger kept trying to install with 1.8.7 support rather than 1.9.3 i've even set spawn mode to conservative. Is there anything I'm missing out?

Publify push to Heroku is rejected with invalid RUBY_VERSION

陌路散爱 提交于 2019-12-12 03:55:32
问题 I'm getting the following message when I push to Heroku: Invalid RUBY_VERSION specified: Unfortunately,-a-fatal-error-has-occurred.-Please -see-the-Bundler-troubleshooting-documentation-at-http://bit.ly/bundler- issues.-Thanks! ! Valid versions: ruby-2.0.0, ruby-1.9.3, ruby-1.9.2, ruby-1.8.7, ruby-1.9.3-jruby-1.7.0, ruby-1.8.7-jruby-1.7.0, ruby-1.9.3-jruby-1.7.1, ruby-1.8.7-jruby-1.7.1, ruby-1.9.3-rbx-2.0.0dev, ruby-1.8.7-rbx-2.0.0dev ! ! Heroku push rejected, failed to compile Ruby/rails app

Confusion with instance variables object id allocation in Ruby

穿精又带淫゛_ 提交于 2019-12-12 03:49:56
问题 I was trying to understand the instance variable initialization and declaration. Doing so I tried the below code. But in the half of my thinking path,I got something interesting as below: class Person attr_accessor :name,:age def initialize(var) @sex = var end def objctid p ":age -> #{@age.object_id}" p ":name -> #{@name.object_id}" p ":sex -> #{@sex.object_id}" end end #=> nil ram = Person.new('M') #=> #<Person:0x2109f48 @sex="M"> ram.objctid #":age -> 4" #":name -> 4" #":sex -> 17321904" #=

ruby-debug-base19-0.11.26 installation errror

自古美人都是妖i 提交于 2019-12-11 11:03:14
问题 I'm trying to get ruby-debug working with ruby 1.9.3 and rails on OSX Lion. I've been following http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug , but my problem is I can't get ruby-debug-base19-0.11.26.gem In my .Gemfile for sources i have source 'http://rubygems.org' source :rubyforge source 'http://gems.rubyforge.org' when I do gem install ruby-debug-base19-0.11.26.gem -- --with-ruby- include=/Users/minadoroudi/.rvm/rubies/ruby-1.9.3-p0/include=/Users/me/.rvm/rubies/ruby-1.9.3

Read MS Word .doc file with ruby and win32ole

风流意气都作罢 提交于 2019-12-11 05:27:21
问题 I'm trying to read .doc file with ruby, I use win32ole library. IT my code: require 'win32ole' class DocParser def initialize @content = '' end def read_file file_path begin word = WIN32OLE.connect( 'Word.Application' ) doc = word.activedocument rescue word = WIN32OLE.new( 'Word.Application' ) doc = word.documents.open( file_path ) end word.visible = false doc.sentences.each{ |x| @content = @content + x.text } word.quit @content end end I kick off doc reading with DocParser.new.read_file(

Heroku not using the specified Ruby 1.9.3

那年仲夏 提交于 2019-12-11 03:48:18
问题 Upgrading to Mongoid 3 and Ruby 1.9.3. Trying to use Ruby 1.9.3 on Heroku Cedar Stack. I have added the below to the top of my Gemfile: source 'http://rubygems.org' ruby "1.9.3" Pushing to Heroku, it seemed to be working -----> Heroku receiving push -----> Ruby/Rails app detected -----> Using Ruby version: ruby-1.9.3 -----> Installing dependencies using Bundler version 1.2.0.rc.2 However my app is breaking as it requires Ruby 1.9.3. The error is coming as: TypeError: can't convert Array into