Am using rails 4 in my application with active admin gem. i wish to change my page default title when am rendering or redirecting to new or edit page , but the below code is not working.
my code is
form :title => { :new => "New action", :edit => "Edit action"} do |f|
f.input reason, :label => "Reason", :input_html => {rows: 5}
end
but when i use the below code its working
def new
@page_title = "New Action"
end
def edit
@page_title = "Edit Action"
end
but after validation rendering on new page its not updating the title ,because its only rendering not redirecting ,
def create
@object = Model.new(params)
respond_to do |format|
if @object.save
flash[:notice] = 'Saved Successfully'
format.html { redirect_to collection_url }
else
format.html { render "new" }
end
end
end
how to solve this problem, can any one please help me