I made a Wysiwyg module where a user can create custom text areas for different sections of their website.
I do this by checking in the controllers if they have created one for this particular section yet. If they have, it redirects them :
def new
if Wysiwyg.find_by_name(params[:name]) != nil
redirect_to edit_admin_wysiwyg_path(Wysiwyg.find_by_name(params[:name]))
else
@wysiwyg = Wysiwyg.new(:name => params[:name])
end
end
The trouble is is Rails still believes its a ‘new’ even though I have redirected the user to edit. How can I ‘clear’ the controller’s and make it really sincerely believe it is actually an ‘edit’ ?
Thanks!
Ah my problem was in my form instantiation
Old and Evil:
Correct: