Skip to content

Instantly share code, notes, and snippets.

@heri
Last active September 9, 2015 20:31
Show Gist options
  • Save heri/aa70f6ee79b893897513 to your computer and use it in GitHub Desktop.
Save heri/aa70f6ee79b893897513 to your computer and use it in GitHub Desktop.
# Saves a comment by current user to an event
def save_event_comment
model._created_at = Time.now
model.save!.then do
flash._notices << "Thanks for adding a comment"
new_event_comment
end.fail do |err|
flash._notices << err.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment