about action create..

there i hava a model named Person the controller is People in the new.html.erb file function form_for(@person) make the start form tag #@person=Person.new

i think it'll call "create" action in PeopleController when invoke submit button but not! it just renders index.html.erb and never access to action create

sorry to my poor English :smiley: wish i hava descriped it clearly...

Your   @person = Person.new should be in the people_controller...

I'd say start with a new rails project...

Generate a scaffold for your person model

-> ruby script/generate scaffold person last_name:string first_name:string dob:datetime

look at the source that is written for you, i.e., new.html.erb has

-> <% form_for(@person) do |f| %> -> ... field stuff... -> <%= f.submit "Create" %> -> <% end %>

setup your database, and all that... then browse to http://localhost:3000/people - click the "New person" link, and look at the page source if you're curious

add a person, fill out the fields and submit. That should hit your people_controller create method (it's a POST, after all).

While not necessarily how you'll end up writing your app in the future, the scaffolded code is a great resource to read in the beginning to see how Rails fits it all together.

thx ! here is my source code . PeopleController def new @person=Person.new end   def create    @person = Person.new(params[:person])

    respond_to do |format|       if @person.save         flash[:notice] = 'Product was successfully created.'         format.html         format.xml { render :xml => @person, :status => :created, :location => @product }       else         flash[:notice]="dont saved"         format.html { render :action => "new" }         format.xml { render :xml => @person.errors, :status => :unprocessable_entity }       end     end   end

new.html.erb <% form_for(@person) do |f| %> <%=f.text_field :first_name %> ..... <%end%>

something wrong here ?

i guess there is something wrong with ROUTER

first i insert data items to mysql database via PHPMYADMIN, the INDEX method show out them but when i click the “show,edit,destroy"links rails give me the response "No action responded to 1" the number is person id. anyone can tell my why?

Yes!just the ROUTER.rb! here is the code   map.resources :people   # Install the default routes as the lowest priority.   map.connect ':controller/:action/:id'   map.connect ':controller/:action/:id.:format' at the beginning i put "map.resources :people" on the end . i think this cause something wrong