Reputation: 27114
I can make a new , and that seems to work. But edit/update does not.
My controller :
def edit
@admin_wysi = AdminWysi.find(params[:id])
end
def update
@admin_wysi = AdminWysi.find(params[:id])
if @admin_wysi.update_attributes(params[:admin_wysis])
redirect_to admin_admin_wysis_path
end
end
And my HAML..
- form_for @admin_wysi, :url => admin_admin_wysis_path do |f|
= f.cktext_area :post_published, :cols => '70', :rows => '30', :width => '555px', :height => '240px', :toolbar => 'HQ'
= f.submit 'Update', {:class => 'button'}
This is literally copy and pasted practically from my "new", so I'm guessing the problem HAS to be from my controller. Also there are no errors, and the SQL is identical in its injections as it was with the 'new'.
Thanks a bazillion everyone.
Upvotes: 0
Views: 69
Reputation: 7500
you need to have an edit form that is slightly different
- form_for @admin_wysi, :url => admin_admin_wysis_path(@admin_wysi) do |f|
And that should be edit.html.haml
UPDATE: it appears you have already done this but you need the following line in your routes.rb in order for the named routes to work.
map.name_space :admin do |admin|
admin.resources :admin_wysi
end
UPDATE: that should be
- form_for @admin_wysi, :url => admin_admin_wysi_path(@admin_wysi) do |f|
to trigger the update action.
Upvotes: 2
Reputation: 8461
Shouldn't it be
@admin_wysi.update_attributes(params[:admin_wysi]
instead of
@admin_wysi.update_attributes(params[:admin_wysis]
?
Upvotes: 1