Hash_for_resource_url problem

Hi everyone,
Im just trying out the new restful routes in Rails. Im having trouble

=> {:use_route=>“resources”, :controller=>“resources”, :action=>“index”,

as expected
but then:

=> cannot convert Resource into Hash

What happened?
so I tried:

hash_for_resource_url(:id => @resource).inspect
=> {:id=>#, @errors={}>, @attributes={“title”=>“resource_title”,
“id”=>“1”}>, :controller=>“resources”, :use_route=>“resource”,
:action=>“show”, :only_path=>false}

No to_param in there?

hash_for_resource_url(:id => @resource.to_param).inspect
=> {:id=>“1”, :controller=>“resources”, :use_route=>“resource”,
:action=>“show”, :only_path=>false}

Right thats what I wanted.

At least I think that’s what I wanted. Is it supposed to work like
that? Doesn’t seem very useful. And the docs say it works by passing in
the id (hash_for_message_url(id))

I guess my question is what are some possible uses of
hash_for_resource_url that make this functionality appropriate? Im
still new to all this.

What I wanted to do was pass the hash into the activerecordhelper#form
method (never seen that method before today, neat). But then when I got
hash_for_resource_url figured out I realized that there is only
hash_for_new_resource_url and hash_for_edit_resource_url. but no
hash_for_update_resource_url, etc. So… Gosh Im just confused I guess.
Can anyone maybe point me in the direction of some good clarifications
of these new generated routes and how they are intended to be used.

Maybe I should ignore all these new fancy named routs and just write
them out like I always have (as controller action id hashes)? Dunno.
Still testing the waters I guess.

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