Silent redirect to index action when uploading images

All,

I’m creating a simple image gallery in my rails app and have a problem
uploading images on production environment (it works perfectly on my
local machine).

I’m hosting it on dreamhost on Apache+FastCGI, with my own Ruby
compiled and Rails 2.0.1 installed in local directory plus Rick
Olson’s AttachmentFu for image uploading. I may have some image
libraries misconfigured, or something, but I cannot tell, because I
cannot see anything in the Rails log file when I click “Submit” in my
browser.

Apache access.log shows me this:

nnn.nnn.nnn.nn - - [04/Jan/2008:01:05:39 -0800] “POST /images HTTP/
1.1” 301 601
http://myapp.example.com/images/new?image[album_id]=1” “Mozilla/
4.0
(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET
CLR 2.0.507
27; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)”
nnn.nnn.nnn.nn - - [04/Jan/2008:01:05:41 -0800] “GET /images/ HTTP/
1.1” 200 1525
http://myapp.example.com/images/new?image[album_id]=1” “Mozilla/
4.
0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET
CLR 2.0.50
727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)”

Nothing appears in Apache error.log and in Rails production.log all I
can see is:

Processing ImagesController#index (for nn.nnn.nnn.nn at 2007-12-22
16:24:57) [GE
T]
Session ID:
BAh7CToOcmV0dXJuX3RvMDoMY3NyZl9pZCIlOWUyOWU0ZTllZDMyOWUyMTJl%0ANDF
hOTczYTc5Y2E2NDU6CXVzZXJpBiIKZmxhc2hJQzonQWN0aW9uQ29udHJv
%0AbGxlcjo6Rmxhc2g6OkZs
YXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–
bcbf702a2ea8014671ecf0d66db743be9f20a1eb
Parameters: {“action”=>“index”, “controller”=>“images”}

No mention of the POST request at all in the production.log. Just
the 301 redirect and since I’m not implementing index action in this
model, I get a 404 after this call.

Anyone has any ideas why the 301 redirect may occur or where I can see
anything logged?

Thanks,
Maciek

OK, I’m responding to my own post, but… problem solved.

It appears that having a model named Image wasn’t a very good choice.
It somehow collided with .htaccess rewriting rules and apache
redirected the request. Changing model name to Picture helped.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs