Embedding link_to's as part of rendered text


#1

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.


#2

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 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 D. 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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie B.
http://www.recentrambles.com