Sam Donaldson
2006-May-31 10:46 UTC
[Rails] embedding link_to''s as part of rendered text.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060531/c1a47f0c/attachment.html
Charlie Bowman
2006-May-31 12:13 UTC
[Rails] embedding link_to''s as part of rendered text.
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:> 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. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsCharlie Bowman http://www.recentrambles.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060531/090c6c8a/attachment.html