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…
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…
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 =>…
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:
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…
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…
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…
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 =…
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…
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 …
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…
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…
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…
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 =>…
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…