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!
on 2007-05-10 03:15
on 2007-05-10 07:12
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 D. 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. <firstname.lastname@example.org> 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
on 2007-05-10 18:45
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!