Friday, May 16th, 2008
The most valuable usage for scaffolding is when you use it in the administration part of the site. The administration is usually separated in separate module/folder.
The new rails scaffolding is not good because:
It is time taking to setup nested scaffold
I have tons of uselss source code in the scaffolding like ...
Posted in Rails | No Comments »
Monday, May 12th, 2008
auto_scope
source: http://blog.teksol.info/archives/2007/3
class Contact < ActiveRecord::Base
auto_scope \
:old => {:find => {:conditions => ["born_on < ?", 30.years.ago]}},
:young => {:find => {:conditions => ["born_on > ?", 1.year.ago]}}
end
class Testimonial < ActiveRecord::Base
auto_scope \
:approved => {
:find => {:conditions => ["approved_at < ?", proc {Time.now}]},
:create => {:approved_at => proc {Time.now}}},
...
Posted in Rails | No Comments »