Update record problem

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

Product category

<% form_for(@pro_categorie,:url=>{:controller => 'admins', :action => 'cateupdate'}) do |f| %> <%= f.error_messages %>
Category Name : <%= f.text_field :pcate_name %>
Category Desc : <%= f.text_field :pcate_desc %>
<%= f.submit 'Update' %>    <%= link_to 'Back', admins_path %>
<%end%>

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

On Aug 11, 10:23 am, Wap A. [email protected]
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

Wap A. wrote:

Frederick C. wrote:

On Aug 11, 10:23�am, Wap A. [email protected]
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

Product category

<% form_for( :pro_categorie, :url => {:action => 'updatecate',:id => @pro_categorie.id}) do |f| %> <%= f.error_messages %>
Category Name : <%= f.text_field :pcate_name %>
Category Desc : <%= f.text_field :pcate_desc %>
<%= f.submit 'Update' %>    <%= link_to 'Back', admins_path %>
<%end%>

Frederick C. wrote:

On Aug 11, 10:23�am, Wap A. [email protected]
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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs