ModelSecurity issues: User vs. Person (was: "cannot convert Symbol into String" after renaming model)

Sean Hussey
Fri, 21 Oct 2005 15:49:21 -0000

Actually, scratch that.  It''s not a bad environment.  It has something
to do with ModelSecurity.

If I take out the code that ModelSecurity puts into application.rb,
everything goes back to normal and the auto complete works with
:person, as expected.

I haven''t introduced any further ModelSecurity code to my app, but
maybe I should.  I''ve created an admin user.  The failure happens
whether or not I''m logged in.

Any ModelSecurity users who can speak to this?  The template trace and
session dump are below.

Thanks,

Sean

TypeError in Manager#

Showing /manager/search.rhtml where line #50 raised:

cannot convert Symbol into String
Extracted source (around line #50):

47:
48:   <%= start_form_tag :action => ''show'' %>
49: Search for people
50: <%= text_field_with_auto_complete :person, :username, { :size =>
30 }, :skip_style => true -%>
51:   <%= submit_tag "Show" %>
52:   <%= end_form_tag %>
53:
Show template trace
/app/helpers/model_security_helper.rb:87:in `+''
/app/helpers/model_security_helper.rb:87:in `restricted_input''
/app/helpers/model_security_helper.rb:80:in `text_field''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/helpers/javascript_helper.rb:405:in
`text_field_with_auto_complete''
(erb):50:in `evaluate_locals''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/base.rb:272:in
`evaluate_locals''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/base.rb:283:in
`rhtml_render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/base.rb:208:in
`send''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/base.rb:208:in
`render_template''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_view/base.rb:173:in
`render_file''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:588:in
`render_with_no_layout''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/layout.rb:216:in
`render_without_benchmark''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`measure''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:591:in
`render_with_no_layout''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/layout.rb:216:in
`render_without_benchmark''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`measure''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:604:in
`render_with_no_layout''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/layout.rb:210:in
`render_without_benchmark''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`measure''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:25:in
`render''
/app/controllers/manager_controller.rb:3:in `index''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in
`send''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in
`perform_action_without_filters''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in
`perform_action_without_benchmark''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`perform_action_without_rescue''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`measure''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`perform_action_without_rescue''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in
`perform_action''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in
`send''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in
`process''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in
`dispatch''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:144:in
`process_request''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:64:in
`process!''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in
`each_cgi''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
`each''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
`each_cgi''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in
`process!''
/Applications/Locomotive/Bundles/rails-0.13.1-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:21:in
`process!''
/Users/sean/Projects/Rails/ldapadmin/public/dispatch.fcgi:24



Request

Parameters: None

Show session dump

---
:user: !ruby/object:User
  attributes:
    name: Sean Hussey
    salt: NvUmk6R7EtiJJ8v//E8kMx1dGelb2831nI1UBnry
    created_on: 2005-10-17 13:00:28
    token: ''''
    updated_on: 2005-10-17 13:00:28
    admin: "1"
    lock_version: "1"
    id: "1"
    cypher:
e37f7203e29173924ec6bfbaff2f659b87569115778f4f5b7da3cd8fa4b40f81a7b199b0080cb9502242bea759c85e247ccb630699f4253724803880e166dbfa
    activated: "1"
    token_expiry: 2005-10-17 13:00:28
    login: ldapadmin
    email: shussey-P6oFqSfzpKaVc3sceRu5cw@public.gmane.org
flash: !ruby/hash:ActionController::Flash::FlashHash {}
Response

Headers: {"cookie"=>[],
"Cache-Control"=>"no-cache"}


On 10/19/05, Sean Hussey
<seanhussey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Tried that.  No go:
>
> undefined method `readable?'' for nil:NilClass
>
> Maybe there''s something different about the Locomotive bundles
that I
> did or didn''t have in my pervious local installation.
>
> I think I''ve narrowed it down to my environment, but I
can''t run
> script/server to see.  I get this:
>
>
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/clean_logger.rb:13:in
> `remove_const'': constant Logger::Format not defined (NameError)
>         from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/clean_logger.rb:13
>         from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
> `require''
>         from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support.rb:31
>         from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
>         from ./script/../config/environment.rb:50
>         from ./script/server:42
>
> I''ll have to try to find another way to get this working, though.
> Thanks for the help!
>
> Sean
>
> On 10/18/05, Tom Davies
<atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Have you tried changing your :person and :username to strings?
> >
> > As in:
> >
> > <%= text_field_with_auto_complete ''person'',
''username'', { :size => 30 },
> > :skip_style => true -%>
> >
> > Tom
>