Forgot to add. I''m using Rails 3. thxs
On Sep 17, 2:26 pm, nobosh
<bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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)
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.