Questions tagged [ruby-1.8.7]

For issues relating to developing in Ruby, version 1.8.7.

Use this specific tag along with the generic one: .

202 questions
3
votes
2 answers

Hash does not contain 'try' method

I am noticing differences between a hash object within Ruby 1.8.7 and a hash object within Rails 3.0.10. For example, within the 1.8.7 irb, I get: 1.8.7 :001 > {}.try(:method) NoMethodError: undefned method `try' for {}:Hash from…
David Weiser
  • 5,070
  • 4
  • 24
  • 35
3
votes
1 answer

Enumerable::each_with_index now optionally takes a arguments in Ruby 1.9. What significance and/or what is a use case for that?

In Ruby 1.8.7 and prior, Enumerable::each_with_index did not accept any arguments. In Ruby 1.9, it will accept an arbitrary number of arguments. Documentation/code shows that it simply passes those arguments along to ::each. With the built in and…
Ryan Sandridge
  • 1,619
  • 16
  • 28
3
votes
1 answer

does memoization works inside of a proc?

I have the following method: def download_link_for(site,title=nil) template = proc {|word|(title ? "%s_#{title}_csv": "%s_csv") % word} if site.send(template.call("update")) == false x.a "Generate", :href =>…
Thermatix
  • 2,224
  • 13
  • 36
3
votes
4 answers

Uncaught ReferenceError: check is not defined

Please help me out with this, jquery is working well in w3schools but in my rails 2 app its getting error like check not defined Here is my html code: Checkbox:
Hemanth M C
  • 426
  • 4
  • 18
3
votes
3 answers

Ruby Digest::SHA512.hexdigest throws a segment fault and quits in Yosemite

We have an older REE rails app that I work on my local dev environment in OSX Yosemite. I recently switched from Mavericks, with which I had no problems. I ran this app for the first time on my new work mac and found I was unable to login due to it…
3
votes
2 answers

DBI Row / delegate behavior between ruby 1.8.7 and 2.1

I execute the following code in ruby 1.8.7 to read rows from my database: require 'dbi' db_conn_handle = DBI.connect("DBI:Mysql:host=localhost;database=mydb;port=3306", "root") sth = db_conn_handle.prepare("select accounts.id, accounts.name from…
Rajat
  • 1,576
  • 1
  • 16
  • 40
3
votes
1 answer

how can you eval "local_variables" in context of a proc? in Ruby

I am using ruby 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin11.2.0] I am playing with Kernet::eval method. The binding may be a Binding object or a Proc object. def eval(string, *binding_filename_lineno) end I have following test.rb require…
Usman
  • 2,247
  • 1
  • 20
  • 18
3
votes
1 answer

Ruby regexp from variable

Using Ruby 1.8.7 I want to store some regular expressions in the database and have them be easily reconstituted as a Regexp object when I need to use them for validation. I've found that Ruby exhibits some unwanted behavior. For instance: r =…
Josh M.
  • 23,573
  • 23
  • 96
  • 160
3
votes
1 answer

Serialization/Deserialization ruby object in YAML

I'm trying to understand the serialization/deserialization of ruby object using YAML under 1.8.7 and 1.9+ and have a few queries regarding it (I can't find much documentation on this) Ruby 1.8.7 class Element yaml_as…
Ratatouille
  • 1,174
  • 3
  • 17
  • 38
3
votes
1 answer

Different exponent behavior for different ruby versions

I'm trying to calculate 2^1000 in ruby, but I'm getting different results for different versions. Any idea why? Using 1.8.7: ~ » rbenv global system ~ ~ » ruby --version …
mportiz08
  • 9,516
  • 12
  • 38
  • 42
3
votes
1 answer

How to write "string".encode("us-ascii") in ruby 1.8.7?

I'm trying to use the "gmail_xoauth" gem and, unfortunately, the gem uses encode("us-ascii") for strings, which is available only for Ruby 1.9.3. I'm not familiar with encode in Ruby 1.9.3 so I wonder what is "string".encode("us-ascii") and how do…
Robert Grezan
  • 1,188
  • 3
  • 12
  • 26
3
votes
1 answer

ajax call when something else is happening in the background

I am trying to display the progress percentage when i upload a file and unzip it. I am using ruby-zip to unzip the file. While unzipping I increment the counter and store it in database. I have a form like <% form_tag '/unzip', :multipart => true…
Sadiksha Gautam
  • 4,604
  • 6
  • 35
  • 67
3
votes
1 answer

rake asset:precompile takes 28 minutes on 1.9.2

I have a pretty large rails app (Rails 3.2.3), using the asset pipeline. There are are quite a few files in the assets folder. Under 1.8.7, running rake assets:precompile takes 4 minutes. This is long, but due to the sheer number of assets I'm…
Ben Scheirman
  • 39,034
  • 20
  • 96
  • 135
3
votes
2 answers

Rspec link_to - including confirm/data-confirm attribute causes test to fail

I have a link as follows that I'm trying to test (please ignore the square brackets): [%= link_to "Delete User", destroy_user_account_path(@profile.user), :class => "delete", :confirm => "a", :title => "Delete #{@profile.user.name}", :method =>…
Reb
  • 639
  • 1
  • 6
  • 12
2
votes
1 answer

ruby .map! or each for modifying an array in place

I have the following: article_results.keys do |key| article_results[key].map! do |a| a[:filename] = c.filename a[:sitename] = c.site_name a end end As I want to add to each element of each array within the hash dynamically, but for…
Thermatix
  • 2,224
  • 13
  • 36
1
2
3
13 14