1 2 3 4
h = {:asdf => 'toto', :titi => 42} => {:asdf=>"toto", :titi=>42} h2 = HashWithIndifferentAccess.new(h) ...
Ruby On val.respond_to? x, but val....
by Fabien Jakimowicz,
July 07, 2010 11:03
1 2 3
class Round < ActiveRecord::Base belongs_to :season ...
Ruby On Validate the nested model
by Fabien Jakimowicz,
March 24, 2009 12:42
I'm not sure why you need t...
1 2 3
class User < ActiveRecord::Base has_many :classrooms ...
Ruby On Too many for loops
by Fabien Jakimowicz,
February 25, 2009 14:20
You can optimize a little b...
1 2 3
class Announcement < ActiveRecord::Base ANNONCEMENT_TYPES = {'squad' => :deliver_squad_announcement, ...
Ruby On Re-Refactor Mailer Conditions
by Fabien Jakimowicz,
February 14, 2009 10:46
You should use callbacks an...
1 2 3
add_index(:accounts, [:branch_id, :party_id], :unique => true) ...
Ruby On While loop to get unique value
by Fabien Jakimowicz,
February 12, 2009 13:34
If you are using ActiveReco...
1
zcat database_dump.sql.gz | mysql -u username -h host -p password database
Bash On Unzip large database dump d...
by Fabien Jakimowicz,
February 12, 2009 12:36
Not really better, but you ...
1 2 3
class Account < ActiveRecord::Base has_many :websites ...
Ruby On Rails - Multiple instances ...
by Fabien Jakimowicz,
August 03, 2008 12:48
You should move a lot of lo...
1 2 3
class MyaccountController < ApplicationController before_filter :load_users, :only => [ 'account_details', 'show_email_box', 'show_mobile_box' ] ...
Ruby On How to make instance variab...
by Fabien Jakimowicz,
July 31, 2008 13:33
You can use a before filter...
1 2 3 4
def update_foo_and_bar # You can also use @foo.class.transaction and @foo.bar.class.transaction if you have multiple database at the same time ActiveRecord::Base.transaction {@foo.update_attributes!(params[:foo]) and @foo.bar.update_attributes!(params[:bar])} ...
Ruby On Saving multiple models in o...
by Fabien Jakimowicz,
July 29, 2008 22:21
there is a lot of way to cl...
1 2 3 4
xml = REXML::Document.new(data) artists = xml.elements.to_a('//artist')[0..limit].collect do |artist| ...
Ruby On cleaner way to limit result...
by Fabien Jakimowicz,
July 14, 2008 23:38
i'm not familiar with REXML...
Ruby On collecting attributes from ...
by Fabien Jakimowicz,
June 17, 2008 15:32
I thought the same about ht...

If your are in Rails projec...