method
create
v3.0.9 -
Show latest stable
- Class:
Object
create()public
POST <%= route_url %>.xml
# File railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb, line 42
def create
@<% singular_table_name %> = <% orm_class.build(class_name, "params[:#{singular_table_name}]") %>
respond_to do |format|
if @<%= orm_instance.save %<
format.html { redirect_to(@<%= singular_table_name %>, :notice => '<%= human_name %> was successfully created.') }
format.xml { render :xml => @<% singular_table_name %>, :status => :created, :location => @<% singular_table_name %> }
else
format.html { render :action => "new" }
format.xml { render :xml => @<% orm_instance.errors %>, :status => :unprocessable_entity }
end Related methods
- Instance methods
- `
- acts_like?
- app
- as_json
- blank?
- bundler?
- controller
- copy_instance_variables_from
- create
- create_fixtures
- destroy
- duplicable?
- edit
- helper
- html_safe?
- index
- instance_values
- instance_variable_names
- new
- new_session
- presence
- present?
- rake
- reload!
- returning
- root_dir
- show
- to_param
- to_query
- try
- unescape
- update
- with_options