I noted that there was a potential for naming conflicts with the klass
name used by active scaffold so I have renamed my system to use
school_class rather than klass.

Here is the associations for school_class:

  has_many :funds

  has_many :mailings

  has_many :students

  has_many :teachers,
    :class_name => "Staff",
    :conditions => "staffs.role = 'teacher'"

  has_many :ias,
    :class_name => "Staff",
    :conditions => "staffs.role = 'ia'"

  belongs_to :first_contact,
    :foreign_key => :first_contact_id,
    :class_name => "User"
    :conditions => "users.role = 'classco'"

  belongs_to :second_contact,
    :foreign_key => :second_contact_id,
    :class_name => "User"
    :conditions => "users.role = 'classco'"

The associated models have their required has_many/belongs_to.

I found an older version of AS that I has used in another project, and
just for the heck of it tried it too see if this might be a problem
with the latest version of AS.
And it happens to be an issue with the latest version of AS. My older
version from September seems to be doing just fine with all my
associations, HABTM's etc etc.


How can I help getting the latest version of AS fixed ?
under Rails 2.3.5 and using the HEAD version of AS I see one of two
errors:

NoMethodError (undefined method `create' for
#<ActiveScaffold::Config::Core:0x2b68bf9e9190>):
  app/controllers/school_classes_controller.rb:
18
<< This is this line:   active_scaffold :school_class do |config|
  passenger (2.2.9) lib/phusion_passenger/rack/request_handler.rb:
92:in `process_request'
  passenger (2.2.9) lib/phusion_passenger/abstract_request_handler.rb:
207:in `main_loop'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
400:in `start_request_handler'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
351:in `handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/utils.rb:184:in `safe_fork'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
349:in `handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`__send__'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`main_loop'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in
`start_synchronously'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:163:in
`start'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
209:in `start'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:262:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:256:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:255:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:154:in
`spawn_application'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:287:in
`handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`__send__'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`main_loop'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in
`start_synchronously'


or I get this error:
Processing ApplicationController#index (for 192.168.0.216 at
2010-01-26 19:35:27) [GET]
  Parameters: {"action"=>"index", "controller"=>"campaigns"}

NoMethodError (undefined method `klass' for nil:NilClass):
  app/controllers/campaigns_controller.rb:
7
<< This is this line:   active_scaffold :campaign do |config|
  passenger (2.2.9) lib/phusion_passenger/rack/request_handler.rb:
92:in `process_request'
  passenger (2.2.9) lib/phusion_passenger/abstract_request_handler.rb:
207:in `main_loop'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
400:in `start_request_handler'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
351:in `handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/utils.rb:184:in `safe_fork'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
349:in `handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`__send__'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`main_loop'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in
`start_synchronously'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:163:in
`start'
  passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:
209:in `start'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:262:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:256:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.9) lib/phusion_passenger/
abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:255:in
`spawn_rails_application'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:154:in
`spawn_application'
  passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:287:in
`handle_spawn_application'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`__send__'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in
`main_loop'
  passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in
`start_synchronously'


There are no models, controllers, helpers, views, library & test
references to a Klass model. Neither is there any klass fields in the
database nor in db/schema.rb.

/S

On Jan 26, 12:54 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> On Martes, 26 de Enero de 2010 08:29:10 Soren escribió:
>
> > 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
>
> Please post your klass model, and its associations.
>
>
>
>
>
> > 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
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Mariana Pineda 23, 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
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