Form's and Actions

Have the following form:

<%= simple_form_for @user, :as => :user, :action =>
“edit_notification” do |f| -%>
<%= f.input :email %>
<%= f.input :email_alerts %>
<%= f.input :email_summarize %>
<%= f.input :email_newsletter %>
<%= f.input :email_announcements %>
<%= f.button :submit %>
<% end %>

It should trigger the edit_notification action ? But it triggers the
standard edit action. Do i have to add more routes then:
resources :users to get it to trigger ?

This is driving me mad at the time.

On 19 Apr 2011, at 07:52, Niklas N. [email protected] wrote:

<% end %>

It should trigger the edit_notification action ? But it triggers the
standard edit action. Do i have to add more routes then:
resources :users to get it to trigger ?

To override the default URL that a form posts to, you need to say
something along the lines of :url => {:action => ‘blah’, :id =>
@user.id}

You don’t have to create a route for it, but it’s generally neater to do
so

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs