Yeah, this is why your images don't get served from rails, your web server will serve static content before it passes the request to rails.
On Mon, Dec 7, 2009 at 11:11 AM, doug livesey <[email protected]> wrote: > Ah, so if I had a controller called Static::ThingsController that *didn't* > have an action named "send", then I could have the other actions of the > controller work as normal, but have the static file > "/public/static/things/send.json" sent statically? > Cool, then I could just fill in the real, dynamic action when I was ready > for it. > > 2009/12/7 Adam Holt <[email protected]> > > Thats not a static file tho, if you had a file called index.json, you could >> put it in /public/static/things/ and it will be served up like that, without >> hitting the rails stack, from http://yourapp.com/static/things/index.json >> >> if you need a controller (for authentication for example), you can do it >> anywhere using routes and send_file '/path/to/index.json', :type => >> 'application/json'. >> >> Adam >> >> On Mon, Dec 7, 2009 at 10:58 AM, doug livesey <[email protected]> wrote: >> >>> I'll cuke it & see what happens! :) >>> >>> >>> 2009/12/7 doug livesey <[email protected]> >>> >>>> Or a less confusable example with a controller called >>>> Static::ThingsController & an index action: >>>> /public/static/things/index.json >>>> >>>> 2009/12/7 doug livesey <[email protected]> >>>> >>>> So, if the controller was Static::ModelsController, and the action was >>>>> index, I'd just create this file: >>>>> /public/static/models/index.json >>>>> >>>>> and that should serve it up? >>>>> Cheers, >>>>> Doug. >>>>> >>>>> 2009/12/7 Caius Durling <[email protected]> >>>>> >>>>> On 7 Dec 2009, at 10:43, doug livesey wrote: >>>>>> >>>>>> > Should I call something like: >>>>>> > render( :file => "/path/to/file.json", :layout => false, :status >>>>>> => :ok ) >>>>>> > >>>>>> > Or is there a better way? >>>>>> >>>>>> >>>>>> Can't you just put it in the right series of folders under ./public >>>>>> and your webserver (assuming apache/passenger, but should work with >>>>>> others) >>>>>> will serve it straight off the disk for you? >>>>>> >>>>>> C >>>>>> --- >>>>>> Caius Durling >>>>>> [email protected] >>>>>> +44 (0) 7960 268 100 >>>>>> http://caius.name/ >>>>>> >>>>>> -- >>>>>> >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "NWRUG" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]<nwrug-members%[email protected]> >>>>>> . >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/nwrug-members?hl=en. >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "NWRUG" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<nwrug-members%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nwrug-members?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "NWRUG" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nwrug-members%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nwrug-members?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "NWRUG" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nwrug-members%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nwrug-members?hl=en. > -- You received this message because you are subscribed to the Google Groups "NWRUG" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nwrug-members?hl=en.
