http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/211440
Example:
Setting.all.each do |setting|
define_method setting.name do |*a|
r = find(:first, :include => :setting, :conditions => ["setting_id = ?", setting.id])
full_record = (a.length == 0) ? false : a[0]
full_record ? r : r.value
end
end
No comments:
Post a Comment