Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Activating the restriction accessors for acts_as_textiled

#3

I think I have found a bug in acts_as_textiled. In my app, I'm using RedCloth 3.0.3 and I need to make sure that textiled attributes enforce the hard_breaks rule. So my model has a declaration like this:

acts_as_textiled :description, {:hard_breaks => true}

In order to get version 0.2 to honor my request, I had to change a line in acts_as_textiled.rb.

ORIGINAL:

textiled[attr.to_s] ||= RedCloth.new(read_attribute(attr), Array(ruled[attr])).to_html if read_attribute(attr)

PATCH:

textiled[attr.to_s] ||= RedCloth.new(read_attribute(attr), ruled.keys).to_html if read_attribute(attr)

It also appears to me that the following line is unnecesary (and possibly harmful), so I removed it.

attrs += ruled.keys

A diff is attached. This plug-in was a life-saver and your Rail Toolbox is a pot of gold.

--Thanks

Reported by Jeff Richardson · April 1st, 2007 @ 12:49 PM

State: resolved
Milestone: none
Assigned to: Chris Wanstrath Chris Wanstrath

Activity

  1. Jeff Richardson
    Jeff Richardson

    There's no bug, my mistake!

    I just needed to do this:

    acts_as_textiled :description => [:hard_breaks]

    Sorry!

    April 1st, 2007 @ 12:49 PM

  2. Chris Wanstrath
    Chris Wanstrath
    • State changed from new to resolved
    • Assigned user set to Chris Wanstrath

    Cool!

    April 1st, 2007 @ 12:49 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.