Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # image.rb
- class Image < ActiveRecord
- has_many :comments, :as => :commentable
- end
- # post.rb
- class Post < ActiveRecord
- has_many :comments, :as => :commentable
- end
- # comment.rb
- class Comment < ActiveRecord
- belongs_to :commentable, :polymorphic => true
- end
- # config/routes.rb
- resources :posts do
- resources comments
- end
- resources :images do
- resources :comments
- end
Add Comment
Please, Sign In to add comment