Friday, April 20, 2012

[Rails] URL link and routes issue

HI all,

I have two problem so i thought i would put them together. First problem
is that i can not what out how to get <%= link_to 'Show', test %> into
a <a href=" here "></a> for the post i have selected. I have got to the
point where i have got <%= test %> would just displays
#<Job:0x007fcd15570168> in the address bar instead of i.e /tests/1 etc.

How can this be done?

Second problem is with the routes. I have routes generated form the
resources :tests when i run scaffold but the when i create a match to
something it keeps on saying "Couldn't find Job with id=whatever". I did
as follows:-

match 'tests/index' => 'tests#index' which comes back "Couldn't find
Job with id=index"
match "/tests/google" => redirect("http://www.google.co.uk") which
comes back "Couldn't find Job with id=google"

What i can understand is that i have a link /test/:id which is causing
the problem, but the thing i don't understand is that there is a link
/tests/new which works so whats stopping my matches working as these
links that was generated automatically are not in the routes.

Any help with these will be great

Thanks

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate