Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Content
- include MongoMapper::Document
- include Versioned
- include Grip
- key :_type, String
- key :image
- key :category_id, ObjectId
- timestamps!
- many :tags, :as => :content
- belongs_to :category
- def tag_list
- tags.collect(&:name).join(", ")
- end
- def tag_list=(tag_str)
- self.tags = []
- tag_str.split(", ").collect{|n| Tag.new(:name=>n)}.each do |tag|
- tags << tag
- end
- save
- tags
- end
- end
Add Comment
Please, Sign In to add comment