Hi everyone
I have a strange routing behavior. And I don''t know when it started
being.
I have a form for image upload using attachment_fu. The code in the view
is
<% form_for(:image, :url => "/images/create", :html => {
:multipart =>
true }) do |form| %>
<%= form.file_field :uploaded_data, :size => 15, :class =>
"formLoader"
%>
<input onClick="loader()" class="uploadButton"
type="image"
src="/images/upload_pic.png"/>
<% end %>
and the controller code is
def create
# Used by start/index
@image = Image.new(params[:image])
@image.kwiker_id = session[:kwiker]
if @image.save
redirect_to(''/grusskarten/deinenachricht/'' +
@image.id.to_s)
else
flash[:error] = ''Das Bild konnte nicht hochgeladen
werden.''
redirect_to(:controller => ''start'')
end
end
so it should route me to /grusskarten/deinenachricht/
if succesful. But I run into a 404 error. The prod.log says
Processing ImagesController#create (for 95.116.6.201 at 2009-11-05
21:38:20) [POST]
Session ID: 33d68daef3fd8a51b3ec968b916ace06
Parameters: {"x"=>"70",
"y"=>"23", "action"=>"create",
"authenticity_token"=>"020d41a157fbc69c314d369d73f7dd47b9fe070f",
"controller"=>"images",
"image"=>{"uploaded_data"=>#<File:/tmp/CGI5622
Redirected to https://test.kwikit.de/images/create
Filter chain halted as [:ensure_proper_protocol] rendered_or_redirected.
Completed in 0ms (DB: 2) | 302 Found
[http://test.kwikit.de/images/create]
Processing ImagesController#show (for 95.116.6.201 at 2009-11-05
21:38:20) [GET]
Session ID: 33d68daef3fd8a51b3ec968b916ace06
Parameters: {"action"=>"show",
"id"=>"create",
"controller"=>"images"}
ActiveRecord::RecordNotFound (Couldn''t find Image with ID=create):
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:
Why does he routes me to ImagesController and action => show?????
It happens only on my production server.
--
Posted via http://www.ruby-forum.com/.
What happens in dev mode locally
Processing ImagesController#create (for 127.0.0.1 at 2009-11-05
21:52:27) [POST]
Session ID: 2e54b69d91dafe551b5edabc637c019b
Parameters: {"x"=>"52",
"y"=>"21", "action"=>"create",
"authenticity_token"=>"4221d581c4a9acc11ef32170b788078b70b3e282",
"controller"=>"images",
"image"=>{"uploaded_data"=>#<File:/var/folders/5c/5cG2ScrbEriNyQAAX0GkLU+++TI/-Tmp-/CGI1416-1>}}
[4;36;1mImage Create (11.8ms) [0m [0;1mINSERT INTO "images"
("name", "size", "created_at",
"content_type", "kwiker_id", "thumbnail",
"category_id", "filename", "height",
"parent_id", "width", "fake_sold",
"real_sold") VALUES(NULL, 336787, ''2009-11-05
21:52:30'', ''image/png'',
4100684228, NULL, NULL,
''c8e367cf60f5f85cd598a9c5c364def122066836.png'',
565, NULL, 755, NULL, NULL) [0m
[4;35;1mImage Load (0.7ms) [0m [0mSELECT * FROM "images" WHERE
("images"."thumbnail" = ''thumb'' AND
"images"."parent_id" = 67) LIMIT
1 [0m
[4;36;1mImage Create (0.7ms) [0m [0;1mINSERT INTO "images"
("name", "size", "created_at",
"content_type", "kwiker_id", "thumbnail",
"category_id", "filename", "height",
"parent_id", "width", "fake_sold",
"real_sold") VALUES(NULL, 309301, ''2009-11-05
21:52:30'', ''image/png'',
NULL, ''thumb'', NULL,
''c8e367cf60f5f85cd598a9c5c364def122066836_thumb.png'', 112, 67,
150,
NULL, NULL) [0m
Redirected to /grusskarten/deinenachricht/67
Completed in 3076ms (DB: 14) | 302 Found
[http://localhost/images/create]
Processing GrusskartenController#deinenachricht (for 127.0.0.1 at
2009-11-05 21:52:31) [GET]
Session ID: 2e54b69d91dafe551b5edabc637c019b
Parameters: {"action"=>"deinenachricht",
"id"=>"67",
"controller"=>"grusskarten"}
[4;35;1mOrder Load (0.2ms) [0m [0mSELECT * FROM "orders" WHERE
(kwiker_id= 4100684228 AND status = 0) LIMIT
As it should be...
--
Posted via http://www.ruby-forum.com/.