@params Hash Access

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 W.
Email: [email protected]

On Jan 25, 2006, at 11:49 AM, Eric W. wrote:

Eric W.
Email: [email protected]


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

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

You were almost there :wink:

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs