Forum: Ruby on Rails @params Hash Access

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4afd33d6e06fdf951d479a6699322cda?d=identicon&s=25 Eric Woodward (Guest)
on 2006-01-25 20:53
(Received via mailing list)
I am trying to load an ActiveRecord object from an ID within a hidden
field in a submitted form. How do I do it?

I get this into the controller with the request:

   Parameters: {"action"=>"index", "website"=>{"id"=>"7"},
"controller"=>"msa/setup"}

So, how do I load the Website object from ID 7?

     @website = Website.new(params[:website])
     @website.reload()

That fails, and this is a crappy way to do it anyway.

   Website.find(params[:website[:id]])

fails as well. How do I get to that ID?

--ejw

Eric Woodward
Email: ejw@statewood.com
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-25 20:59
(Received via mailing list)
On Jan 25, 2006, at 11:49 AM, Eric Woodward wrote:

>
>
> Eric Woodward
> Email: ejw@statewood.com
>
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


Website.find(params[:website][:id])

You were almost there ;)

Cheers-
-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
This topic is locked and can not be replied to.