Closed SergeyKishenin closed 9 years ago
We ran into the same problem with Rails 4.2.1. It looks like, under Rails 4.2.1:
<%= f.text_area :content %>
is no longer providing the string value of content, but we're getting the Ruby serialization instead:
[#<SirTrevorRails::Blocks::TextBlock text="<p>text</p>", isHtml=true>]
A workaround seems to be doing something like:
<%= f.text_area :content, value: f.object['content'] %>
Thanks for reporting. I’ll look into what we can do about getting this fixed
-- Andrew Walker ["@ninjabiscuit", "07886655448"] http://madebymany.com
On 24 March 2015 at 16:28:53, Chris Beer (notifications@github.com) wrote:
We ran into the same problem with Rails 4.2.1. It looks like, under Rails 4.2.1:
<%= f.text_area :content %>
is no longer providing the string value of content, but we're getting the Ruby serialization instead:
[#<SirTrevorRails::Blocks::TextBlock text="<p>text</p>", isHtml=true>]
A workaround seems to be doing something like:
<%= f.text_area :content, value: f.object['content'] %>
— Reply to this email directly or view it on GitHub.
I've managed to fix this in my application by writing an initialiser to add a to_s method that constructs a JSON object for the block array.
module SirTrevorRails
class BlockArray < Array
def to_s
{data: as_json}.to_json
end
end
end
I have same issue with rails 4.2.3
same issue, my workaround is f.object.read_attribute(:content)
This should be fixed now. We also have Travis running against a few different versions of ruby so things like this should get caught a little easier from now on
Thanks @ninjabiscuit
@adamcarlile np :+1:
With Rails 4.2.1 I get
In JS console:
Sorry there has been a problem with parsing the JSON
SyntaxError: Unexpected token #
while with Rails 4.2.0 it works fine.