#3 ✓resolved
Jeff Richardson

Activating the restriction accessors for acts_as_textiled

Reported by Jeff Richardson | 2007-04-01 12:49:46 UTC

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

Comments and changes to this ticket

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.

New ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Attachments

Pages