Arrgh - major problem :( - auto_complete returns could not recognize segment

0 views
Skip to first unread message

walt

unread,
May 5, 2008, 8:18:45 AM5/5/08
to resources_controller

Hi Ian,

afraid that I have to ask for your help once more :(

(and knowing that you're knee deep in giving brith, I'd be more than
happy to settle for a hint as to where I have to start looking)

In quite a few of my controllers I use auto_complete (instead of
<selects> I find it to be a nicer UserExperience with auto_complete)

I added the skip_before_filter (it also fails without this statement)
that you suggested Chris Hapgood to using in another post here - but
somehow this will not fly :(

Here are the murky details:


My controller:
class ProjectsController < ApplicationController #<
ResourceController::Base #

# perhaps transform_with_xsl needs this one?
require 'xml/xslt'

before_filter :login_required
after_filter :transform_with_xsl, :only => :display_invoice
skip_before_filter :verify_authenticity_token
skip_before_filter :load_enclosing_resources, :only
=> :auto_complete_for_project_contact_name

#belongs_to [:customer, :supplier, :user]
resources_controller_for :projects
inherit_views


def auto_complete_for_project_contact_name
lookup_contact params[:project]
end

clipped----for-brewity
end

My config/routes.rb

clipped----------

map.resources :projects, :has_many =>
[ :tasks, :jobs, :purchases, :invoices ], :collection => {
:quoted_sales => :get,
}, :member => {
:invoice => :get,
:display_invoice => :get
}

clipped------------

My view/projects/_form.html.erb

<%= text_field_with_auto_complete resname, :contact_name,
{ :autocomplete => "off", :size => 40 }, :skip_style => true,
:with => "value + '&' +
Form.Element.serialize('#{resname}_partner_name')",
:after_update_element =>
"function(element,value) " +
"{
dn = value.childNodes;
$('#{resname}_new_contact_id').value =
dn[0].firstChild.nodeValue;
$('#{resname}_contact_name').value =
dn[1].firstChild.nodeValue;
$('#{resname}_partner_name').value =
dn[2].firstChild.nodeValue;
$('#{resname}_partner_name').focus();
}"
%>

Stack trace:


Processing ProjectsController#auto_complete_for_project_contact_name
(for 127.0.0.1 at 2008-05-05 13:33:49) [POST]
Session ID:
BAh7CDoMdXNlcl9pZGkGOgxjc3JmX2lkIiUyNjJkMjA2MTliNDdjZTQwZjBi
%0AYjVhMjE0ZmMyYWJhZCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxh
%0Ac2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--
d3ce4f52e32b6e38cf1679af45b9dee94a9dd88f
Parameters: {"project"=>{"partner_name"=>"Dansk Amatør Teater",
"contact_name"=>"po"},
"authenticity_token"=>"cc5242a8c6ff1335067015e15d397e9c0a5830f9",
"action"=>"auto_complete_for_project_contact_name",
"controller"=>"projects"}
User Columns (0.003762) SHOW FIELDS FROM `users`
User Load (0.000748) SELECT * FROM `users` WHERE (users.deleted_at
IS NULL OR users.deleted_at > '2008-05-05 13:33:49') AND (`users`.`id`
= 1)


Ardes::ResourcesController::MissingSegment (Could not recognize
segment 'projects' in route:
ANY /:controller/:action/:id/ {}

Check that config/routes.rb defines a route named 'projects'
for controller: ProjectsController"
):
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:887:in `raise_missing_segment'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:706:in `enclosing_segments'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:729:in `route_enclosing_names'
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
core_ext/object/misc.rb:28:in `returning'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:728:in `route_enclosing_names'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:772:in `load_wildcards_from'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:742:in `load_enclosing_resources'
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160:in `each_with_index'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:740:in `each'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:740:in `each_with_index'
/vendor/plugins/resources_controller/lib/ardes/
resources_controller.rb:740:in `load_enclosing_resources'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:469:in `send!'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:469:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:441:in `run'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:716:in `run_before_filters_without_response_for'
/vendor/plugins/response_for/lib/ardes/response_for.rb:124:in
`run_before_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:695:in `call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:689:in `perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
rescue.rb:199:in `perform_action_without_caching'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
caching.rb:678:in `perform_action'
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:33:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
query_cache.rb:8:in `cache'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
caching.rb:677:in `perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:524:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:524:in `process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:685:in `process_without_session_management_support'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session_management.rb:123:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:388:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:171:in `handle_request'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:115:in `dispatch'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:126:in `dispatch_cgi'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:9:in `dispatch'
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:
112:in `handle_dispatch'
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:
78:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/webrick/server.rb:82:in `start'
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:
62:in `dispatch'
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/
webrick.rb:66
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/rubygems/custom_require.rb:27:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:496:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:342:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:496:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3

Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/templates/rescues/layout.erb (internal_server_error)

Ian White

unread,
May 5, 2008, 10:41:22 AM5/5/08
to resources_...@googlegroups.com
Ok, so the fact you're getting that error means the before_filter *is*
being run.

So, try fiddling with the skip_before_filter call - maybe put it after
the resources_controller call

That's all I can do at the moment :)

By the way, feel free to add any of these issues that you regard as
bugs, rather than not knowing how, to lighthouse, so I'll remember to
get to them after being sleep deprived for a couple of weeks.

Cheers,
Ian

Tim Harding

unread,
May 5, 2008, 12:05:42 PM5/5/08
to resources_...@googlegroups.com
On Mon, May 5, 2008 at 1:18 PM, walt <wal...@diechmann.net> wrote:


and knowing that you're knee deep in giving brith

 
what an appalling visual. 

Ian White

unread,
May 5, 2008, 12:20:16 PM5/5/08
to resources_...@googlegroups.com
> > and knowing that you're knee deep in giving brith
>
> what an appalling visual.

Indeed.

I didn't really intend for the rc list to become a birth tumblog, but
there you go...

--
Argument from Design--We build web applications
Western House 239 Western Road Sheffield S10 1LE UK
Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712
<http://www.ardes.com/> | <http://blog.ardes.com/ian>

Tim Harding

unread,
May 5, 2008, 12:45:37 PM5/5/08
to resources_...@googlegroups.com
:)

walt

unread,
May 5, 2008, 2:46:24 PM5/5/08
to resources_controller
Tim Harding and Ian White,

I apologize for log.humanize() - and for offending you! That was
certainly not intentional and please accept my apologies!

English not being my native tongue is no excuse and I deeply regret my
off topic comments.

Sincerely,
walt

walt

unread,
May 5, 2008, 2:55:55 PM5/5/08
to resources_controller
>
> So, try fiddling with the skip_before_filter call - maybe put it after
> the resources_controller call

That sure did the trick - thank you very much, Ian!

>
> That's all I can do at the moment :)
>
> By the way, feel free to add any of these issues that you regard as
> bugs, rather than not knowing how, to lighthouse, so I'll remember to
> get to them after being sleep deprived for a couple of weeks.

I will do so - but I know way to little to start pointing my fingers
at you/anybody, so maybe I'll just add them as "sequence dependant" if
that option is available.

Thank you again, and sorry for that stupid break of netiquette - that
sure was bad judgement on me part!

Best regards,
Walther

Ian White

unread,
May 5, 2008, 4:44:35 PM5/5/08
to resources_...@googlegroups.com
> I apologize for log.humanize() - and for offending you! That was
> certainly not intentional and please accept my apologies!

> English not being my native tongue is no excuse and I deeply regret my
> off topic comments.

No offense taken walt! I though it was hilarious (and an appalling visual).
I'm pretty sure that Tim was not offended either.

And you've given me a reason to show my wife the contents of the RC-list

Tim Harding

unread,
May 5, 2008, 5:22:20 PM5/5/08
to resources_...@googlegroups.com
Walt,

I wasn't offended, it was simply an amusingly horrendous combination of idiom and context.

You owe me no excuse nor any regret. Also, like many English as a second language students, your English and your humility put mine to shame.

-Tim

walt

unread,
May 6, 2008, 8:53:57 AM5/6/08
to resources_controller
Tim (and Ian),

sigh! (the sound of relief that escaped me)

Thank you for those kind words -

Many kind regards from (seldom) sunny Denmark
walt

Ian White

unread,
May 8, 2008, 4:24:04 PM5/8/08
to resources_...@googlegroups.com
I wouldn't want anyone to be left wondering... and this thread is
well and truly off topic now

Boy is here, safe and sound, mother well, and is a bloody legend.
Everyone very happy and very knackered

Tim Harding

unread,
May 8, 2008, 4:42:01 PM5/8/08
to resources_...@googlegroups.com
congratulations.

walt

unread,
May 9, 2008, 12:49:06 PM5/9/08
to resources_controller

Hi Ian,

great :)

Many sincere congratulations and my best wishes for Junior and his
legendary albeit bloodied entourage a deux ;)

Now may be an excellent moment to pull your armchair into a shadowed
corner of the garden, sit back, and slowly let the fragile torpedos of
ivory blackend, spanish babling, womens hard labour embodied in large
brown leaves and capitalized on by green dressed revolutionaries
incinerate and watch them vanish into dust and bluish fumes forcing us
to recall that chaos theory is a very untangible and yet very present
constant in a universe inhabited by little miniscule toes and fingers
small enough to disappear in ones ears :)

Any grandparents to fester on the grandious result? None better to
express what wonders you have produced under the astonished sun ;)

- and now I promise to stay on topic (at least for the time being) <:)

Cheers,
walt
Reply all
Reply to author
Forward
0 new messages