app/models/notebook.rb
def add_tag(tag, user=nil)
    return unless tags.where(tag: tag).empty?
    tag = Tag.new(tag: tag, user: user, notebook: self)
    tags.push(tag) if tag.valid?
  end
# Add a tag (applied by user) to this notebook
Add a tag (applied by user) to this notebook
Add a tag ( applied by user ) to this notebook
def add_tag(tag, user=nil)
    return unless tags.where(tag: tag).empty?
    tag = Tag.new(tag: tag, user: user, notebook: self)
    tags.push(tag) if tag.valid?
  end
def add_tag ( tag , user = nil ) return unless tags . where ( tag : tag ) . empty? tag = Tag . new ( tag : tag , user : user , notebook : self ) tags . push ( tag ) if tag . valid? end
Add a tag (applied by user) to this notebook
Add a tag ( applied by user ) to this notebook
tag
user