Hello, Rails newbie... trying to understand the right way to do things...
In my app users can create a Book ( I have that working)
What I want to happen is when a user creates a book, a record is added to the BookCharacters Table, something like (id, book.id, user.id, characterdescription.string.)
When the book is created, the user who created it should automatically be added as the first BookCharacter. After than the user can then manually add/edit as many BookCharacters as they want. But initially I want them added automatically by default.
So in my Book controller I have:
def create
@book = Book.new(params[:book])
respond_to do |format|
if @book.save
....
With Rails, is it the practice to add that kind of logic after the book is saved? Something like
Book.create( :creator => current_user.id)
I appreciate the help