Topic: [SOLVED]can yield be modified to react to line break ?

I would like to control the behavior of 'yield' inside a block.

Specifically that it does return a specified line of text.

Any/Many genius reading this ?

Last edited by ediestel (2007-12-18 02:01:55)

Re: [SOLVED]can yield be modified to react to line break ?

Could you give an example? Not quite sure what you mean here..

Re: [SOLVED]can yield be modified to react to line break ?

When he's returning text from a text field, he wants all new lines converted into <br />'s.

text.gsub("\n","<br>")

Sometimes figuring out questions is a bit like playing charades.

Re: [SOLVED]can yield be modified to react to line break ?

It's a little complicated, but it's working; gsub() was a part needed for the solution.

I have a partial that I capture with block_to_partial;
then I pass the 'body' to a partial that contains 'editable_content'.

This way the captured partial becomes editable; there is some more conditional functionality.

The problem was: the update method form editable_content returns a text string with html code
to have it display right.
When you use 'editable_content' multiple times, it will add a <br /> on each trip to the server. The space between the lines grows.
A gsub function that avoided that did the job.

No way to figure that out from the initial question smile, were was I ? I was looking for a way to edit_in_place a dynamically rendered text: A report summary is dynamically generated, and  you can edit_in_place this report summary before you print.

Last edited by ediestel (2007-12-19 05:39:51)