Forum: Ruby on Rails embedding link_to's as part of rendered text.

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.
036be8d5d83a98e546b98d64e3fd6c20?d=identicon&s=25 Sam Donaldson (Guest)
on 2006-05-31 12:48
(Received via mailing list)
Hi,

I'd like to be able to do a database query, fetch some text, and add an
'Accept Request' and 'Deny Request' within the text.  Both of these
would be
links so if the user were to click on them, they would essentially send
POST
requests back to the server.  Since this is dynamic, I wanted to know
the
safest/best approach in embedding these links within fetched text coming
from a query?

Should I embed the 'link_to("Accept Request"....)' in the text before
saving
it in the database, so that when it gets fetched, the view should
automatically parse that and see a link_to?  Or, are there other ways.

Thanks.
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-05-31 14:15
(Received via mailing list)
If you want to embed the link_to in the database, you'll need to render
it inside of a controller.  This seems like the best way to avoid "hard
coding the links".  I've tried my hardest to produce a plugin that would
render text held within <view</view> tags, but it appears that rails is
setup in a way that makes this nearly impossible.

On Wed, 2006-05-31 at 03:46 -0700, Sam Donaldson wrote:
> saving it in the database, so that when it gets fetched, the view
> should automatically parse that and see a link_to?  Or, are there
> other ways.
>
> Thanks.
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie Bowman
http://www.recentrambles.com
This topic is locked and can not be replied to.