code_junkie

How do you run a “do” block in a Rails Model while still listing a :dependent?

Nov 12th, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. has_many :posts do
  2. def recent
  3. find(:all, :order => 'created_at desc', :limit => 12)
  4. end
  5. end
  6.  
  7. has_many :posts, :dependent => :destroy do
  8. def recent
  9. find(:all, :order => 'created_at desc', :limit => 12)
  10. end
  11. end
Add Comment
Please, Sign In to add comment