I built a simple index method after I removed AS. def index @users = User.find(:all) end
And build a view that just lists a bunch of fields. I made sure to list all associated fields to see if any of there had problems. None did. I could actually take all of the associations that I had to remove in order to get AS to somewhat function and put them back in. I the replaced AS back in the controller (and removed the index method) I added a very simple AS config back in there: active_scaffold :user (you write user, but it is the singular form of the model that goes in here right ?) After this addition AS was trying to look for some users based on users.user_id which obviously threw an SQL error. So look like I need to hunt for something in the associations that causes AS to make the invalid assumption that users are referenced by user_id and not just by id. Adding a structure like: active_scaffold :user do |config| config.column = [.......] end caused the error to go away. So it must be something with one of the fields. Any good insights to how to find the fields that are causing this ? /S On Feb 2, 2:15 pm, Kenneth Ortmann <[email protected]> wrote: > I'm not sure what you mean. > > So if you just put active_scaffold :users in the controller it breaks? > > On Tue, Feb 2, 2010 at 4:08 PM, Soren Christensen <[email protected]>wrote: > > > Just quickly toss all references into a braindead index page. > > > Works just fine. All associations loads correctly. > > > Looks a lot like an AS problem to me. > > > BTW Is there a method like inspect that lists all associations as well ? > > /S > > > Soren Christensen wrote: > > > Good suggestion ! > > > Results: > > > After removing the AS config section, the route and adding a new index > > method to the controller and a index view the controller LOADS AND DISPLAYS > > after a server restart. > > > Before we conclude that this is indeed an AS problem the index page really > > ought to test out every association as well. > > Right now it does not - but it will in a couple of hours. More later. > > > /S > > > Kenneth Ortmann wrote: > > > What I would do is comment out everything in the UsersController that is > > for active scaffold. > > > I would try to start my server and see if it works. > > > If it works I would add just this to my controller > > > active_scaffold :users > > > If that works then I would start to add every link of the method back one > > at a time. > > > Try commenting out all of the active scaffold stuff and see if your server > > works as expected, and let me know what happens. > > ~Kenny > > > On Tue, Feb 2, 2010 at 1:37 PM, Soren Christensen <[email protected]>wrote: > > >> Hi Kenny, > > >> Thanks for offering your help. > > >> I do have a the route entry! > > >> Yes it was working - or perhaps I never triggered the conditions that > >> seems to be causing this. System has grown over time. > >> I was trying to look at the AS code - but I'm missing the big overview of > >> it - is there a way to instrument it such that it would list the columns > >> that it is processing - perhaps that could reveal a clue. > > >> The error appears consistently right after a restart of the server. The > >> controller refuses to start every single time when it is redirected_to as > >> part of the login process. > >> If I instead start in one of several other controllers and then go back to > >> users it works fine. > >> Is there some loading dependency that I need to cover. > >> The model for user only has "has_many" dependencies - and the full log > >> never lists any of the other models nor controllers. > > >> /S > > >> Kenny Ortmann wrote: > > >> This is random and might be hard to track down... > >> do you have > >> map.resources :users, :active_scaffold => true > > >> in your routes? This shouldn't matter for the create method but I'm just > >> trying to narrow things down. > > >> Was this controller working at one point in time? > >> ~Kenny > > >> On Tue, Feb 2, 2010 at 12:44 PM, Soren Christensen > >> <[email protected]>wrote: > > >>> Sure! > > >>> class UsersController < ApplicationController > > >>> include ERB::Util # to get the h function loaded > > >>> layout "default", :except => [ :create2, :new2, :forgot_password , > >>> :reset_password] > > >>> # Protect these actions behind an admin login > >>> before_filter :admin_required, :only => [:suspend, :unsuspend, :su, > >>> :destroy, :purge] > > >>> before_filter :login_required > >>> skip_before_filter :login_required, :only => [:new2, :create2, > >>> :activate, :forgot_password, :reset_password] > > >>> # This is the hook for Active Scaffold to dynamically modify the list > >>> of columns. > > >>> before_filter :update_table_config > > >>> active_scaffold :user do |config| > > >>> #config.columns = [:login, :first_name, :last_name, :address, :city, > >>> :zip, :email, :home_phone, :cell_phone, :work_phone] > > >>> config.columns.exclude :updated_at, :created_at > > >>> # Config adds the password columns > >>> config.create.columns = [:login, :first_name, :last_name, :address, > >>> :city, :zip, :email, :home_phone, :cell_phone, :work_phone, :password, > >>> :password_confirmation] > > >>> config.show.columns = [:first_name, :last_name, :address, :city, > >>> :zip, :email, :home_phone, :cell_phone, :spouse_first_name, > >>> :spouse_last_name, :spouse_address, :spouse_city, :spouse_zip, > >>> :spouse_email, :spouse_home_phone, :spouse_cell_phone, :spouse_work_phone] > > >>> config.list.columns = [:login, :state, :first_name, :last_name, > >>> :spouse_first_name, :spouse_last_name, :address, :city, :zip, :email, > >>> :home_phone, :cell_phone, :spouse_work_phone] > > >>> config.update.columns = [:first_name, :last_name, :address, :city, > >>> :zip, :email, :home_phone, :cell_phone, :work_phone, :spouse_first_name, > >>> :spouse_last_name, :spouse_address, :spouse_city, :spouse_zip, > >>> :spouse_home_phone, :spouse_cell_phone, :spouse_work_phone, :spouse_email] > > >>> config.list.always_show_search = true > > >>> config.actions.swap :search, :live_search > > >>> config.list.sorting = [{ :last_name => :asc}, {:first_name => :asc}] > > >>> config.columns[:home_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:cell_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:work_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:first_name].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:last_name].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:address].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:city].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > > >>> config.columns[:spouse_last_name].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:spouse_first_name].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:spouse_home_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:spouse_cell_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:spouse_work_phone].description = > >>> "Please just enter 10 digits, no spaces, dashes(-), nor ()" > >>> config.columns[:spouse_address].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > >>> config.columns[:spouse_city].description = > >>> "Please enter data as you want it printed on Forms, Directories > >>> etc" > > >>> list.per_page = 50 > > >>> config.action_links.add 'activation', > >>> :label => "Activate", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :activation_authorized? > > >>> config.action_links.add 'respw', > >>> :label => "Reset Password", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :respw_authorized? > > >>> config.action_links.add 'admin_suspend', > >>> :label => "Suspend", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :activation_authorized? > > >>> config.action_links.add 'admin_unsuspend', > >>> :label => "Un-suspend", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :activation_authorized? > > >>> config.action_links.add 'su', > >>> :label => "Su", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :activation_authorized?, > >>> :confirm => false > > >>> config.action_links.add 'pf', > >>> :label => "PF", > >>> :type => :record, > >>> :inline => false, > >>> :security_method => :pf_authorized?, > >>> :confirm => false > > >>> end > > >>> def update_table_config > >>> if not current_user.nil? > >>> if !current_user.has_role?('user') > >>> active_scaffold_config.list.columns.exclude :login, :state, > >>> :roles > >>> if current_user.has_role?('admin') > >>> active_scaffold_config.list.columns.add :login, :state, :roles > >>> active_scaffold_config.update.columns.add :roles > >>> else > >>> active_scaffold_config.update.columns.exclude :roles > >>> end > >>> else > >>> active_scaffold_config.list.columns.exclude :login, :state, > >>> :roles > >>> end > >>> end > >>> end > > >>> I have some additional methods in there to support the > >>> restful_authentication plugin etc. > >>> They are likely all just the standard stuff. Let me know if we want those > >>> too. > > >>> /S > > >>> Kenny Ortmann wrote: > > >>> can you paste the entire users_controller please? > > >>> On Tue, Feb 2, 2010 at 10:43 AM, Soren Christensen > >>> <[email protected]>wrote: > > >>>> Noted that there was some problem with my config.columns > > >>>> They looked like this: > > >>>> config.columns.exclude :updated_at, :created_at > >>>> config.create.columns = [:login, :first_name, :last_name, .... ] > >>>> config.show.columns = [:first_name, :last_name, ..... ] > >>>> config.list.columns = [:login, :state, :first_name, :last_name, .... > >>>> ] > >>>> config.update.columns = [:first_name, :last_name, :address, ...... ] > > >>>> users_controller:16 is > >>>> active_scaffold :user do |config| > > >>>> Here is the new backtrace: > > >>>> /rails/formdir_v2/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:19:in > >>>> `method_missing' > >>>> /rails/formdir_v2/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb:186:in > >>>> `method_missing' > >>>> /rails/formdir_v2/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb:137:in > >>>> `send' > > ... > > read more » -- 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.
