So, I'm trying to use JBuilder to return some fairly standard json, one of the fields being some markdown parsed into HTML by Redcarpet.
json.categories @all_categories do |category|
json.extract! category, :name
json.black_icon_url category.black_icon.url
json.white_icon_url category.white_icon.url
json.events category.events do |event|
json.extract! event, :name, :short_description
json.descripton event, @markdown.render(event.description) # LOOK HERE!
json.image_url event.image.url
json.contacts [event.contact1, event.contact2] do |contact|
json.extract! contact, :name, :phone, :facebook_username if contact
end
end
end
The problem is that this piece of fairly simple code throws a NoMethodError
.
Showing /../app/views/events/index.json.jbuilder where line #8 raised:
undefined method `<p>Speed is what defines us.</p>...
I'm a bit puzzled by this... it seems like this string is somehow turning into a method call?