Forum: Ruby on Rails Link_to

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.
C8b6317b8541c22fc9a9ab5d62e0d4bd?d=identicon&s=25 noooooo10. (Guest)
on 2007-05-10 01:15
(Received via mailing list)
Hiya!

I am really new to RoR, and I have a little tiny question:

I have a database column called url. I have a simple bookmarking app
and I would like a button called "open" that will take the user to the
url stored in the database. Sounds simple, and the code I used was
this:

<%= link_to 'Open', bookmark["url"] %>

But I keep getting errors. Anybody know what I would have to do to get
it to work?

Help is greatly appreciated!
A73f446eaaf56db0aeaa578aa373989b?d=identicon&s=25 Terry Donaghe (Guest)
on 2007-05-10 05:12
(Received via mailing list)
Hi,

First, you need a model for your table.  Then, before the rhtml page
loads
you need to find the proper row in that table (you do that in your
controller) and save it in a variable like @bookmark.  Then your code
will
look something like

<%= link_to 'Open', @bookmark.url %>

I strongly suggest you get a copy of "Agile Web Development with Rails
2nd
Ed" and read through the entire tutorial chapters before you go much
further.  There are also numerous free tutorials you find by googling.

Good luck!

Terry

On 5/9/07, noooooo10. <iainwall@gmail.com> wrote:
>
> <%= link_to 'Open', bookmark["url"] %>
>
> But I keep getting errors. Anybody know what I would have to do to get
> it to work?
>
> Help is greatly appreciated!
>
>
> >
>


--
Terry (TAD) Donaghe
http://tadspot.tumblr.com
C8b6317b8541c22fc9a9ab5d62e0d4bd?d=identicon&s=25 noooooo10. (Guest)
on 2007-05-10 16:45
(Received via mailing list)
Thanks very much for you help.

Interestingly, I ordered the book last night anyway!

Look forward to using RoR, and thanks once again for your help!
This topic is locked and can not be replied to.