Jake McArthur successfully answered Rich Collins's question:

Can someone please help with this odd error? It appears that rails is not parsing the url correctly.
However, browsing to the url http://guruza.com/question/244/0.0/523#comment_537 does not replicate the error

A ActiveRecord::StatementInvalid occurred in question#index:

PGError: ERROR: invalid input syntax for integer: "523#comment_537"
: SELECT * FROM conversations WHERE (conversations."id" = '523#comment_537' ) LIMIT 1
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'

-------------------------------
Request:
-------------------------------

* URL: http://guruza.com/question/244/0.0/523#comment_537
* Parameters: {"action"=>"index", "reward"=>"0.0", "conversation_id"=>"523#comment_537", "id"=>"244", "controller"=>"question"}
* Rails root: /var/www/guruza

-------------------------------
Session:
-------------------------------

* @write_lock: true
* @session_id: **HIDDEN**
* @new_session: false
* @data: {:request_data=>
{:request_uri=>"/question/244/0.0/523#comment_537", :raw_post=>nil},
"flash"=>{}}

-------------------------------
Environment:
-------------------------------

* DOCUMENT_ROOT : **HIDDEN**
* FCGI_ROLE : RESPONDER
* GATEWAY_INTERFACE : CGI/1.1
* HTTP_ACCEPT : text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
* HTTP_ACCEPT_CHARSET : ISO-8859-1,utf-8;q=0.7,*;q=0.7
* HTTP_ACCEPT_ENCODING: gzip
* HTTP_ACCEPT_LANGUAGE: es
* HTTP_COOKIE : **HIDDEN**
* HTTP_HOST : guruza.com
* HTTP_REFERER : http://guruza.com/
* HTTP_USER_AGENT : Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
* HTTP_X_FORWARDED_FOR: 83.41.203.33
* HTTP_X_MOZ : prefetch
* PATH_INFO :
* QUERY_STRING :
* REDIRECT_STATUS : 200
* REDIRECT_URI : /dispatch.fcgi
* REMOTE_ADDR : **HIDDEN**
* REMOTE_PORT : 48682
* REQUEST_METHOD : GET
* REQUEST_URI : /question/244/0.0/523#comment_537
* SCRIPT_FILENAME : /var/www/guruza/public/dispatch.fcgi
* SCRIPT_NAME : /dispatch.fcgi
* SERVER_ADDR : 66.220.26.12
* SERVER_NAME : guruza.com
* SERVER_PORT : 80
* SERVER_PROTOCOL : HTTP/1.1
* SERVER_SOFTWARE : lighttpd/1.4.10

* Process: 15875
* Server :

-------------------------------
Backtrace:
-------------------------------

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/postgresql_adapter.rb:148:in `execute'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/postgresql_adapter.rb:362:in `select'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/postgresql_adapter.rb:129:in `select_all'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in `find_by_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:924:in `find_every'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:918:in `find_initial'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1103:in `method_missing'
[RAILS_ROOT]/app/controllers/question_controller.rb:21:in `index'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform_action_with_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_with_benchmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_with_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform_action_with_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_with_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process_with_session_management_support'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in `process_request'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in `process!'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in `process!'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in `process!'
[RAILS_ROOT]/public/dispatch.fcgi:24

People succeed in answering Rich Collins's questions 37% of the time (32 successes in 86 attempts).

Answers by: Jake McArthur | Dave

Jake McArthur's Answer:

Reply by Jake McArthur 906 days ago

Very odd. Seems like the anchor is being sent from client along with the rest of the URL, which, to my knowledge, is not supposed to happen. I'm not sure. Looks like either a bug in the client browser or in Rails itself. Possible workaround would be to manually parse out the anchor in the URL (the # and everything after it). Not the optimal solution, but seems to be the only one unless you feel like digging into Rails' code or just blaming the client.

Reply by Rich Collins 906 days ago

Well I think it is happening very infrequenlty. No one has submitted a bug yet. I don't think it is worth looking into it further at this point. I was just hoping someone else had come across it.

Chat Conversation 906 days ago

hey Rich Collins at 10:38 PM on Sunday July 16th, 2006
hello Jake McArthur at 10:39 PM on Sunday July 16th, 2006
what's up? Rich Collins at 10:39 PM on Sunday July 16th, 2006
i believe i managed to replicate the situation by manually making an http request via telnet, but of course it did not give me any debug info Jake McArthur at 10:39 PM on Sunday July 16th, 2006
hmm Rich Collins at 10:39 PM on Sunday July 16th, 2006
but i thought it would be good to verify that that's what just happened Jake McArthur at 10:39 PM on Sunday July 16th, 2006
let me see if there was an error Rich Collins at 10:39 PM on Sunday July 16th, 2006
yep Rich Collins at 10:40 PM on Sunday July 16th, 2006
i made sure and sent the anchor along with the rest of the url in the request Jake McArthur at 10:40 PM on Sunday July 16th, 2006
so that's what's happening Jake McArthur at 10:40 PM on Sunday July 16th, 2006
hmm so when you click on a link Rich Collins at 10:40 PM on Sunday July 16th, 2006
maybe you could ignore the anchor somehow by changing your routes? Jake McArthur at 10:41 PM on Sunday July 16th, 2006
it does not request the anchor in the Rich Collins at 10:41 PM on Sunday July 16th, 2006
for whatever weird browser is doing that? Jake McArthur at 10:41 PM on Sunday July 16th, 2006
Rails supports the anchor Rich Collins at 10:41 PM on Sunday July 16th, 2006
rails shouldn't even be getting the anchor Jake McArthur at 10:41 PM on Sunday July 16th, 2006
Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Rich Collins at 10:42 PM on Sunday July 16th, 2006
clients shouldn't be sending it i'm sure Jake McArthur at 10:42 PM on Sunday July 16th, 2006
FireFox in Spanish Rich Collins at 10:42 PM on Sunday July 16th, 2006
So where is the anchor usually in the request Rich Collins at 10:42 PM on Sunday July 16th, 2006
strange Rich Collins at 10:42 PM on Sunday July 16th, 2006
hmm Jake McArthur at 10:42 PM on Sunday July 16th, 2006
the anchor is not in the request, it's supposed to be entirely client-side Jake McArthur at 10:43 PM on Sunday July 16th, 2006
Hmm but you can link to another page with an anchor Rich Collins at 10:43 PM on Sunday July 16th, 2006
and if I enter the url manually Rich Collins at 10:43 PM on Sunday July 16th, 2006
yes, but the browser is supposed to handle all that by itself Jake McArthur at 10:43 PM on Sunday July 16th, 2006
it works Rich Collins at 10:43 PM on Sunday July 16th, 2006
yes Jake McArthur at 10:43 PM on Sunday July 16th, 2006
I see so it is never sent Rich Collins at 10:44 PM on Sunday July 16th, 2006
but not if you craft an http request by hand like i did Jake McArthur at 10:44 PM on Sunday July 16th, 2006
it just saves the info Rich Collins at 10:44 PM on Sunday July 16th, 2006
you can't put an anchor into that Jake McArthur at 10:44 PM on Sunday July 16th, 2006
yes Jake McArthur at 10:44 PM on Sunday July 16th, 2006
I see Rich Collins at 10:44 PM on Sunday July 16th, 2006
ok I think that answers my question Rich Collins at 10:44 PM on Sunday July 16th, 2006
thanks Rich Collins at 10:44 PM on Sunday July 16th, 2006
no prob Jake McArthur at 10:44 PM on Sunday July 16th, 2006