Tak wrote:> Hi. I''m a newbie on Ruby on Rails (this is my first post).
>
> I want to write a form where users can create or edit a claim. One of
> the fields is a company. Since there is an internal code for each
> registered company, I want the users to search by company name.
>
> On the form, I plan to add a link called "Search Company". This
link
> will take the user to another form to find a company by name, and the
> matching ones will be displayed as links. If the user click on any of
> the links, the claim form page will be redisplayed with the selected
> company and the rest of the data the user has entered. Right now, I
> have a table called claims and a model that matches it.
>
> In Java Servlet Faces, I use <t:saveState value="#{form}"
> id="formSaved"></t:saveState> to pass the objects to the
next page,
> but I''m not sure how to do it on Rails. Any help?
>
> Thanks.
Well, there''s always several ways to get the skin off the cat, but I
would just save the id of the selected company in the "session".
Something like this in the action that fires when they click on a
company...
session[:selected_company_id] =
Company.find_by_name(params[:selected_company])
(this assumes you are returning the selection as "selected_company")
hth,
jp
--
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
-~----------~----~----~----~------~----~------~--~---