"Wolas!" wrote:
> it would be a good idea to post the controller method update and the
> class Model.
But how can I fix that error message? Database information is updating
properly but page is redirecting to HTTP 500 Internal server error page
and I am unable to fix this error. Please help me how can i fix it. I am
using code below to be updating model entry... and same code works
properly for other modules.
# PUT /models/1
# PUT /models/1.xml
def update
@model = Model.find(params[:id], :include=>:user)
respond_to do |format|
if @model.update_attributes(params[:model])
@model.user.roles.clear
@model.user.roles << Role.find_or_create_by_name("model")
#flash[:notice] = "Model was successfully updated."
#format.html { redirect_to([:admin, @model]) }
#format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @model.errors, :status =>
:unprocessable_entity }
end
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---