Skip to content

Instantly share code, notes, and snippets.

@getnashty
Created July 27, 2015 04:09
Show Gist options
  • Save getnashty/10c4757513821b5dc398 to your computer and use it in GitHub Desktop.
Save getnashty/10c4757513821b5dc398 to your computer and use it in GitHub Desktop.
def create
if @discussion.save
if params[:tags]
first_tag = ''
params[:tags].each do |tag|
if first_tag != tag
first_tag = tag
@discussion.discussion_tags.create!(
taggable_id: tag['taggable_id'],
taggable_type: tag['taggable_type'].singularize.capitalize,
position: @discussion.discussion_tags.count + 1
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment