REST and remote_form_for

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">

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

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...@andreas-s.net>

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 ...

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...@andreas-s.net>

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