Why Object.class == Class in Ruby?
I think Object is everyone's ancestor, including Class. So I think it should be Class.class == Object. I feel a bit of confused and twisted ...
I think Object is everyone's ancestor, including Class. So I think it should be Class.class == Object. I feel a bit of confused and twisted ...
Hi, val1 = 1 val2 = "1" if val1 == val2 #< Question is in this line end How to compare number and its string representation? ...
It seems like the default select for Sequel is "select *", which causes all kinds of problems when you add some joins. At the very least you end up with the wrong ids in your objects (because there will then be more than one "id" column returned). Doing something like .select("people.*") would seem to work, but that treats the string ...
I like an idea of document oriented databases like CouchDB. I am looking for simple analog. My requirements is just: persistance storage for schema less data; some simple in-proc quering; good to have transactions and versioning; ruby API; map/reduce is aslo good to have; should work on shared hosting What I do not need is REST/HTT...
As my Rails app matures, it's becoming increasingly apparent that it has a strong data warehouse flavour, lacking only a facts table to make everything explicit. On top of that, I just read Chapters 2 (Designing Beautiful APIs) and 3 (Mastering the Dynamic Toolkit) of Ruby Best Practices. Now I'm trying to figure out how best to design...
I have a view like this, <% count = 1 %> <% for voting in @voting %> <% if voting.question_id.eql?(count) %> <%= radio_button( count, voting.vote_count, :radio_id => voting.nominees ) %> <%= voting.nominees %> <% end %> <% if voting.nominees.eql?(radio_id) %> <% voting.update_attribute('vote_count...
I have 4 related migrations in my Rails app: First 3 migrations create one table each in the self.up and and drops them in their respective self.down methods. 4th migration runs a rake task that loads data to all three (in self.up). I am thinking what to put in self.down of this migration to delete the rows from the 3 tables? Am I doi...
I have created an application in shoes and the .dmg(.app) and .exe version work on there respective target systems, but how do I control the icon that is used for the executable files? I just can't find any documentation on this. I plan on using many little helpful shoes applications and would like to have different icons to visually d...
I have a problem installing PL/Ruby for PostgreSQL 8.4 on Windows XP PostgreSQL 8.4 is installed and working OK Ruby-186-27 is installed and working OK I have MinGW installed and I'm using MSYS as the command line shell I have downloaded plruby-0.5.3 and unzipped. My PostreSQL is in C:\Program Files\PostgreSQL\8.4 I've created a record...
Say I have a User model with the following code in User.rb: before_create :create_dependencies after_create :build_inbox And I also have a users.yml file with a bunch of user fixtures defined in it. When I run rake db:fixtures:load, it doesn't appear to trigger the callbacks. Is this how it is expected to work? If so, why did they...
Is there an equivalent ruby/RoR method for PHP get_meta_tags. I am looking to read the meta tag information of a given url ...
As of Rails 2.3, what's the right way to add a directory to the load path so that it hooks into Rails' auto-reloading mechanisms? The specific example I'm thinking of is I have a class that has several sub-classes using STI and I thought it would be a good idea to put them in a sub-directory rather than clutter the top-level. So I woul...
I'm trying to make a web app in Sinatra, and I was wondering if there was a good solution for user sign-up with email verification, as well as authentication - perhaps as rack middleware? OpenID support would be nice to have too. I suppose I can roll my own, but I didn't want to reinvent the wheel. If I have to do so, can anyone point m...
What HTML parser for Ruby will I find easiest to use if I'm already familiar / in love with jQuery? Such a parser would have jQuery's overall philosophy -- "grab some HTML elements (using CSS selectors) and do things with them" -- and in addition have equivalents for all of jQuery's DOM manipulation functionality (prepend(), after(), et...
At least sometimes when I navigate to a page I get this exception undefined method `force_encoding' for #<String:0x898922c> Anyone else seen this problem? ...
In Ruby I can add instance variables to a class by opening it, and doing something like this : class Whatever def add_x @x = 20 end end and this would add me an instance variable by the name of x. How can I do the same thing in Groovy? ...
I've read that Ruby has inherited many features from Lisp. What features does Ruby have that likely have a Lisp heritage? ...
Two quick questions about ruby's string#crypt(salt) method. In the documentation it claims the salt should be two characters? I thought a salt could be anything I wanted, no? I am using a random value that is larger than two characters and it seems to work fine. Is this an error in the documentation or in my understanding of how this w...
I'm using Ubuntu 9.04 x64 and, I have a file startup.rb in which I call sudo bash, so that I always have a root console to do administrative tasks without typing password after every 15 minutes or so. This script is called by another script Startup.rb, and content of both files are like this - File ~/Startup.rb #!/usr/bin/ruby system...
I need 2 db connections in my rails model, is there a not so hackey way to do that? any links or search keywords would be great :) ...