When a user successfully updates a record using the edit form, I'd like it to re-render the form with the notice (like the wordpress dashboard does). Right now, when someone successfully updates a page record, the view isn't updated. Here is the update method in my Admin::Page controller:
def update
@page = Page.find_by_permalink!(params[:id])
if @page.published? && @page.published_at == nil
@page.published_at = Time.now
elsif [email protected]? && @page.published_at != nil
@page.published_at = nil
end
if @page.update_attributes(page_params)
render action: "edit", notice: 'Page was successfully updated.'
else
render action: "edit"
end
end
What should I substitute for render action: "edit"?