views:

563

answers:

3

Hi guy,

I update my rails application 2.0.2 to 2.3.5. I use active scaffold for the administration part.

I change nothing in my code but a problem is coming with the update. I have a controller 'admin/user_controller' to manage users.

Here is the code of the controller:

    class Admin::UserController < ApplicationController

  layout 'admin'

  active_scaffold :user do |config|
    config.columns.exclude :content, :historique_content, :user_has_objet, :user_has_arme, :user_has_entrainement, :user_has_mission, :mp, :pvp, :user_salt, :tchat, :notoriete_by_pvp, :invitation
    config.list.columns = [:user_login, :user_niveau, :user_mail, :user_bloc, :user_valide, :group_id] #:user_description, :race, :group, :user_lastvisited, :user_nextaction, :user_combats_gagner, :user_combats_perdu, :user_combats_nul, :user_password, :user_salt, :user_combats, :user_experience, :user_mana, :user_vie
    config.create.link.page = true
    config.update.link.page = true
    config.create.columns.add :password, :password_confirmation
    config.update.columns.add :password, :password_confirmation
    config.create.columns.exclude :user_password, :user_salt
    config.update.columns.exclude :user_password, :user_salt
    config.list.sorting = {:user_login => 'ASC'}
    config.subform.columns = []
  end
end

This code hasn't change with the update, but when I go in this page, I got this error:

    uninitialized constant Users

/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize'
/Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:28:in `reverse_matches_for'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `each'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `reverse_matches_for'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:11:in `reverse'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/column.rb:117:in `autolink?'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:107:in `links_for_associations'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:106:in `links_for_associations'
/Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:59:in `active_scaffold'
/Users/Kiva/Documents/Projet-rpg/jeu/app/controllers/admin/user_controller.rb:11

I search since 2 days but I don't find the problem, can you help me please.

A: 

I'd guess it has to do with your controller and maybe model name (user_controller instead of users_controller, and you use active_scaffold :user).

I think Rails is looking for a model named users and your model is named user. Did you add an inflector rule for this?

JRL
As I said before, I change nothing since the update and the code worked before so I don't think Rails search a bad name.My controller is in the file admin/user_controller.rb and it's named "Admin::UserController"My model is in file user.rb and it's named "User"I don't add an inflector rule, I don't know what it is ^^
Kiva
A: 

Please, someone can help me, I search on Google but this error doesn't appear and this f** error block me to deploy the new version of my website.

Kiva
A: 

I offered an answer here

http://stackoverflow.com/questions/2015532/

Hope that works.

John