Hi,
I don''t see where i''m wrong, it''s probably terribly
stupid, but i don''t
get the point...
I''m investigating the resources mapping, but the path mapping
doesn''t
seem to work :
in my config directory
map.resources :clients
class ClientsController < ApplicationController
def create
@client = Client.create(params[:client])
end
end
in my view :
<% remote_form_for @client do |f| %>
(...)
<%= submit_tag ''OK'' , :id =>
"submit_form_client" %>
<% end %>
The html generated is :
<form onsubmit="new Ajax.Request(''/clients'',
{asynchronous:true,
evalScripts:true, parameters:Form.serialize(this)}); return false;"
method="post" id="client_" class="new_client"
action="/clients">
>>>> controller keeps hitting the index action, whatever i try.
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I am new to RoR, but don''t you have to explicitly specify the action
of your form? The Ajax code above seems to have the index as action.
So, I have tried something like:
<% remote_form_for @client, :url => { :action => ''some method
in your
controller'' :id -> @client} do |f| %>
Amrita
On Jul 1, 2:15 pm, nico Itkin
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
>
> I don''t see where i''m wrong, it''s probably
terribly stupid, but i don''t
> get the point...
>
> I''m investigating the resources mapping, but the path mapping
doesn''t
> seem to work :
>
> in my config directory
> map.resources :clients
>
> class ClientsController < ApplicationController
> def create
> @client = Client.create(params[:client])
> end
> end
>
> in my view :
>
> <% remote_form_for @client do |f| %>
> (...)
> <%= submit_tag ''OK'' , :id =>
"submit_form_client" %>
> <% end %>
>
> The html generated is :
>
> <form onsubmit="new Ajax.Request(''/clients'',
{asynchronous:true,
> evalScripts:true, parameters:Form.serialize(this)}); return false;"
> method="post" id="client_" class="new_client"
action="/clients">
>
> >>>> controller keeps hitting the index action, whatever i try.
>
> --
> Posted viahttp://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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
amrita wrote:> I am new to RoR, but don''t you have to explicitly specify the action > of your form? The Ajax code above seems to have the index as action. > > So, I have tried something like: > > <% remote_form_for @client, :url => { :action => ''some method in your > controller'' :id -> @client} do |f| %> > > Amrita > > On Jul 1, 2:15 pm, nico Itkin <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>new to rails too... apparently i don''t need to write the action name in the view thanks to the path mapping defined in route.rb, rails find from the route and the method of the query. but apparently it''s not working ... and i don''t know why ... -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
nico Itkin wrote:> amrita wrote: >> I am new to RoR, but don''t you have to explicitly specify the action >> of your form? The Ajax code above seems to have the index as action. >> >> So, I have tried something like: >> >> <% remote_form_for @client, :url => { :action => ''some method in your >> controller'' :id -> @client} do |f| %> >> >> Amrita >> >> On Jul 1, 2:15 pm, nico Itkin <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > new to rails too... > > apparently i don''t need to write the action name in the view thanks to > the path mapping defined in route.rb, rails find from the route and the > method of the query. > > but apparently it''s not working ... and i don''t know why ...the problem came from the file routes.rb, the default mapping routes have to be placed at in last position... works perfectly now !! itkin -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---