It's an Active Record method:
>From api.rubyonrails.org:
klass()

Returns the class for the macro. For example,
composed_of :balance, :class_name => ‘Money‘ returns the Money class
and has_many :clients returns the Client class.

[ hide source ]

     # File vendor/rails/activerecord/lib/active_record/reflection.rb,
line 105
105:       def klass
106:         @klass ||= class_name.constantize
107:       end

...jon

On Jan 25, 11:29 pm, Soren <[email protected]> wrote:
> Hi,
>
> I have a large fairly complex system and I have ended up with a error
> surrounding the associations between the models.
>
> Unfortunately the error message is not very clear to me. Can anyone
> help ?
>
> I have a model/controller pair named klass/klasses. Is this a reserved
> word and therefore the source of the problem ?
>
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.klass
>
> RAILS_ROOT: /rails/formdir-dev
> Application Trace | Framework Trace | Full Trace
>
> /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> reflection.rb:257:in `source_reflection'
> /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> reflection.rb:257:in `collect'
> /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> reflection.rb:257:in `source_reflection'
> /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> reflection.rb:316:in `derive_class_name'
> /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> reflection.rb:112:in `class_name'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/extensions/
> reverse_associations.rb:11:in `reverse'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/active_scaffold/
> data_structures/column.rb:117:in `autolink?'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/
> active_scaffold.rb:107:in `links_for_associations'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/active_scaffold/
> data_structures/columns.rb:62:in `each'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/active_scaffold/
> data_structures/columns.rb:62:in `each'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/
> active_scaffold.rb:106:in `links_for_associations'
> /rails/formdir-dev/vendor/plugins/active_scaffold/lib/
> active_scaffold.rb:59:in `active_scaffold'
> /rails/formdir-dev/app/controllers/users_controller.rb:16
> /rails/formdir-dev/app/controllers/user_logins_controller.rb:9

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to