On Aug 15, 1:32 am, Tommy  Bergeron <[email protected]> wrote:
> Hi!
>
> Okay, so let's start I'm starting rails so here's a noob question for
> you!
>
> I did a little blog with scaffolding. Everything is working as
> expected but I'd like to modify it's functionality.
>
> I've been a PHP developer for ages and I'm currently using symfony for
> almost a year. It's a PHP framework that works in some way like rails.
>
> In my little blog I, sometimes, enter ruby codes with HTML tags (<>)
> but as there's nothing to convert them to html entities they are not
> showing up on the page.
>
> As you can see onhttp://rails.tbergeron.comThey are plain HTML tags
> in my html layout.
>
> So here's what I'd like to do:
> I'd like to override my model's save method to put something like h()
> around my text so html could be converted to entities.

This sounds like a possible job for before_save. Personally though I'd
store unsanitized text in the database and sanitize it when displaying
(having escaped text in the database might make your editing bits
rather more complicated).

Fred
>
> Could you help? That'd be awesome!
>
> Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to