Skip to content

Instantly share code, notes, and snippets.

@pjambet
Last active December 11, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjambet/4524078 to your computer and use it in GitHub Desktop.
Save pjambet/4524078 to your computer and use it in GitHub Desktop.
# Create new comment
Comment.create( :author => "sacha", :message => "toto", :recipe => r)
# Ya plus simple
r.comments.create author: 'sacha', message: 'toto'
# Normalement ca devrait pas poser de problemes de mass assignment ca
def get_name_for_user user
user
end
r.comments.create author: get_name_for_user('sacha'), message: 'toto'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment