I am trying to experiment with a plugin that uses a .rjpg template to
generate an image rendered by rmagick.
All seems well, but the file is rendering with application.rhtml layout
around it. And considering the data is binary image data, this is
obviously not what I want.
So I have this in my plugins init.rb:
ActionController::Base.exempt_from_layout ‘rjpg’
but it has no effect. I also tried using :rjpg and /.rjpg$/ to no
avail. I tried putting the call to exempt_from_layout in my
environment.rb, and in the controller that is calling this template, but
no matter what it still renders with a layout.
The only way I can suppress the layout is explicitly telling the layout
not to render inside my action:
def foo @image = Image.find(1)
render :layout => false
end
This seems like a silly requirement, especially since
expempt_from_layout is supposed to work with edge/1.2. I have tested
both version and cannot get the layout to be ignored for the render.
Anyone used exempt_from_layout successfully? What am I doing wrong
here.
Since I am 90% sure this is a legitimate bug, I have created a ticket
with a failing test. If anyone has any solutions for this problem,
propose a patch and lets get this fixed!
PNGs are awesome. But they are either 8-bit and small in filesize, or
they are full color and large in filesize. JPEG’s represent a good
balance between filesize and image fidelity that PNG still can’t match
for photographic data.
But this discussion is really outside the scope of my question here. I
am simply trying to learn to write template handlers.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.