Guest User

Untitled

a guest
Apr 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class Category < ActiveRecord::Base
  2. validates_presence_of :name
  3. has_many :feeds, :dependent => :delete_all
  4.  
  5. def stories(options = {})
  6. foo = id
  7. Story.instance_eval do
  8. with_scope(:find => options) do
  9. find :all, :joins => :feed,
  10. :conditions => [ 'feeds.category_id = ?', foo ]
  11. end
  12. end
  13. end
  14. end
Add Comment
Please, Sign In to add comment