Yet another send_data :image question...

Guys & gals,

I'm also learning RoR (using v2.3.4). I've got a basic scaffold
working for image file creation, and - to a point - image file
display.

The send_data function is working in my controller - no problem. The
model code is able to parse the uploaded file construct too.

  def show
    @image = Image.find(params[:id])
    send_data(@image.binary_data, :type =>
@image.content_type, :disposition=>"inline")
  end

The issue with my output page, specifically "show". All attempts to
render the page, result in *only* the image (.jpg, .png, ... format
unimportant) being rendered. No other HTML makes it to the browser.

I've tried code variants with <% image_tag .... %> to no avail.

Ideas? I'd like to keep the remainder of my hair over this one.

-Brian

Guys & gals,

I'm also learning RoR (using v2.3.4). I've got a basic scaffold
working for image file creation, and - to a point - image file
display.

The send_data function is working in my controller - no problem. The
model code is able to parse the uploaded file construct too.

def show
@image = Image.find(params[:id])
send_data(@image.binary_data, :type =>
@image.content_type, :disposition=>"inline")
end

The issue with my output page, specifically "show". All attempts to
render the page, result in *only* the image (.jpg, .png, ... format
unimportant) being rendered. No other HTML makes it to the browser.

This controller action will only ever send a chunk of image data to a
browser. If you wanted that image to be served on a page then you
would need a separate page (server by a different action (and/or
controller) that contained an img tag whose src points at the action
you've pasted above

Fred

Aha. <light bulb goes on.>

Thanks Fred, this makes sense. Appreciate it.

Hi all,

I've been joining this mailing list for two days and read some interesting topics.
I haven't started out my RoR installation yet, so i don't have any tech-related questions or experiences. But I wonder if I can get some inputs on RoR. I've been reading some posts over the internet, and I see that some of them mention "don't use RoR for something it does not meant to be used".
I can't help but to question, exactly, what RoR meant to be used? And what kind of job that RoR shouldn't be used?
I'm going to build a web based system, something like hospital information system, concerning patient health record and such, and wonder if RoR is perfect for this job?

Thanks.

Regards,
Arga

I’ve been joining this mailing list for two days and read some interesting topics.

I haven’t started out my RoR installation yet, so i don’t have any tech-related questions or experiences. But I wonder if I can get some inputs on RoR. I’ve been reading some posts over the internet, and I see that some of them mention “don’t use RoR for something it does not meant to be used”.

I can’t help but to question, exactly, what RoR meant to be used? And what kind of job that RoR shouldn’t be used?

I’m going to build a web based system, something like hospital information system, concerning patient health record and such, and wonder if RoR is perfect for this job?

Absolutely.

A dynamic website is ideal for Rails. I don’t know what they other posters mean (having not read them), but there used to be arguments about Rails not scaling (not anywhere near being true now, if indeed it ever was).

I probably wouldn’t use it for a 1-3 page site, but anything more complex than that, every time!

Cheers,

Andy

I agree with Andy. About the only excuse not to use Rails these days is it’s still kind of a pain in the ass to deploy (but it’s gotten MUCH better with Passenger and is fairly idiot proof now). Rails also makes life somewhat difficult if you’re not following the Rails way; like working with legacy databases or for some reason needing to massively violate the MVC pattern. But, even those things are possible. Some Rails add-ons (gems, libraries) can be difficult on Windows as well. Ideally you’re developing on a Mac and deploying to Linux. But, again, a lot of people dev on Windows… I did the first year I was doing Rails.

I’m not sure how much of the ‘doesn’t scale’ stigma was associated Ruth twitter but architecturally rails is optimised for “web-based business object lifecycle management” (most dynamically generated sites) rather than “real-time massively distributed message networks” (twitter) the latter of which benefits from mechanisms for super fast memory-based queuing systems. They’re different problems; luckily many including me think rails does pretty well with the former.