As I transition from jbuilder to Rabl for the search page on my website in order to increase speed, I've noticed a significant improvement - it's now about 50% faster without any additional optimizations. This is definitely a positive development.
However, I've encountered a challenge when trying to send a paperclip URL through Rabl to the view.
The original Jbuilder view looks like this:
json.array!(@venues) do |venue|
json.extract! venue, :id, :name, :longitude, :latitude, :price_range, :venue_category_id, :address, :short_description, :max_capacity
json.venue_images venue.venue_images do |vi|
json.url vi.image.url(:big)
json.urlthumb vi.image.url(:thumb)
json.id vi.id
end
Currently, my Rabl view is structured as follows:
object @venues
attributes :id, :name, :longitude, :latitude, :price_range, :venue_category_id, :address, :short_description, :max_capacity
child :venue_images do
attributes :id, :caption
child :image do
attributes :url
end
end
While this setup successfully retrieves and displays the images, I am facing an issue with using the Paperclip helper on the :url attribute. Whenever I attempt to use :url(:thumb), Rabl throws a syntax error.
Is there a workaround for this problem?
Thank you.