i have admins controller and in this i want to two times update one for admin and other for cateupdate both methods are different. def catedit @pro_categorie = ProCategorie.find(params[:id]) end def cateupdate @pro_categorie = ProCategorie.find(params[:id]) respond_to do |format| if @pro_categories.update_attributes(params[:pro_categorie]) flash[:notice] = ''Product category was successfully updated.'' #format.html { redirect_to(@admin) } format.html { redirect_to(admins_url) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @pro_categorie.errors, :status => :unprocessable_entity } end end end ==================>>> cateedit.html.erb <div align="center"> <h3>Product category</h3> <% form_for(@pro_categorie,:url=>{:controller => ''admins'', :action => ''cateupdate''}) do |f| %> <%= f.error_messages %> <table> </tr> <td><lable>Category Name :</lable></td> <td><%= f.text_field :pcate_name %></td> </tr> <tr> <td><lable>Category Desc :</lable></td> <td><%= f.text_field :pcate_desc %></td> </tr> <tr> <td colspan="2" align="center"><%= f.submit ''Update'' %> <%= link_to ''Back'', admins_path %></td> </tr> </table> <%end%> </div> i got error ActiveRecord::RecordNotFound in AdminsController#update Couldn''t find Admin with ID=cateupdate i have pro_categories table edit file display record but when i press update i give me above error -- Posted via http://www.ruby-forum.com/.
On Aug 11, 10:23 am, Wap Addon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> i got error > ActiveRecord::RecordNotFound in AdminsController#update > > Couldn''t find Admin with ID=cateupdate > > i have pro_categories table edit file display record but when i press > update i give me above errorin a restful world when you add actions you need to add them to your routes file (see the :member and :collection options to map.resources) Fred> -- > Posted viahttp://www.ruby-forum.com/.
Frederick Cheung wrote:> On Aug 11, 10:23�am, Wap Addon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> i got error >> �ActiveRecord::RecordNotFound in AdminsController#update >> >> Couldn''t find Admin with ID=cateupdate >> >> i have pro_categories table edit file display record but when i press >> update i give me above error > > in a restful world when you add actions you need to add them to your > routes file (see the :member and :collection options to map.resources) > > Fredi am not understand your suggestion. -- Posted via http://www.ruby-forum.com/.
Wap Addon wrote:> Frederick Cheung wrote: >> On Aug 11, 10:23�am, Wap Addon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> >> wrote: >>> i got error >>> �ActiveRecord::RecordNotFound in AdminsController#update >>> >>> Couldn''t find Admin with ID=cateupdate >>> >>> i have pro_categories table edit file display record but when i press >>> update i give me above error >> >> in a restful world when you add actions you need to add them to your >> routes file (see the :member and :collection options to map.resources) >> >> Fred > > i am not understand your suggestion.i have to fix my problem like this <div align="center"> <h3>Product category</h3> <% form_for( :pro_categorie, :url => {:action => ''updatecate'',:id => @pro_categorie.id}) do |f| %> <%= f.error_messages %> <table> </tr> <td><lable>Category Name :</lable></td> <td><%= f.text_field :pcate_name %></td> </tr> <tr> <td><lable>Category Desc :</lable></td> <td><%= f.text_field :pcate_desc %></td> </tr> <tr> <td colspan="2" align="center"><%= f.submit ''Update'' %> <%= link_to ''Back'', admins_path %></td> </tr> </table> <%end%> </div> -- Posted via http://www.ruby-forum.com/.