3 class Link < ActiveRecord::Base
4 attr_accessible :title, :url, :user_id
8 validates :user_id, presence: true
9 validates :url, presence: true
11 validates :url, :format => URI::regexp(%w(http https))
12 validates :title, :format => /\S/
14 default_scope order: 'links.created_at DESC'
16 def serializable_hash(options=nil)
18 super(options).merge({"tags" => self.tag_list})