Here's what my parts_controller's create method looks like:


# POST /parts
# POST /parts.xml
def create
# Record current user's id as he/she created the part
params[:part][:created_by] = current_user.id
params[:part][:updated_by] = current_user.id

@part = Part.new(params[:part])

if @part.save
flash[:notice] = 'Part was successfully created.'
redirect_to( :action => 'index' )
else
format.html { render :action => "new" }
end
end

--
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@googlegroups.com.
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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 9, '12 at 11:01a
activeJan 10, '12 at 9:04a
posts3
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

K.M.: 3 posts

People

Translate

site design / logo © 2021 Grokbase