Erwin,
If I understand what you are trying to do then I was trying to solve a
similar but lesser problem. How to send form data from one method in a
controller to another method in the same controller Iit does seem to
work for your case though). Here is a sample erb:
gather.html.erb
<h1>Gathering transient data</h1>
<% form_tag('transient/show') do %><!--sends to the show method of the
transient controller-->
<p>
<b>First Name</b><br />
<%= text_field_tag "firstname", TransientData.firstname %>
<br/><b>Last Name</b><br />
<%= text_field_tag "lastname", TransientData.lastname %>
<%= submit_tag "Submit" %>
</p>
<%end%>
show.html.erb
<h1>Gathering transient data</h1>
<% form_tag('/transient/gather') do%> <!--and back to gather-->
<p>
<b>First Name</b><br />
<%= TransientData.firstname %>
<br/><b>Last Name</b><br />
<%= TransientData.lastname %>
<%= submit_tag "Submit" %>
</p>
<%end%>
If I change either erb file's line:
<% form_tag('/someothermodel/somemethod')
It did swap form data between controllers.
I hope I understood your question. I am new to ruby.
Cris
Kad Kerforn wrote:
> @trainee is an instance of User class
>
> my form partial code :
>
> <% form_for :@trainee, :html => {:class => 'generalform'} do |form| %>
> <%= render :partial => "form", :object => form %>
> <%= form.submit "Register", :class => 'go' %> <%= link_to
> 'Cancel', trainees_path %>
> <% end %>
>
> the generated html is obviously :
> <form id="new_user" class="generalform" method="post" action="/users">
>
> but I would like to send it to a trainee_controller (rather than to
> user_controller... )
>
> (don't want to subclass, I am using roles, and a trainee is a user
> with 'trainee' role
>
> is it possible ?if yes, how should I proceed ?
>
> many thanks ba
> erwin
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---