Interesting.
So when I tried running AdminController.method_defined?('index')
I found an error in one of my models. I had a
many_to_one :users
instead of the singular
many_to_one :user
Fixing this makes the scaffolding work. Maybe this exception is being
swallowed during whatever class compilation happens as part of a Rails
Request?
In any case, it works for me now. Thanks for your time, Jeremy.
P.S. Here is the stack trace:
NameError: uninitialized constant Users
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in
`block in constantize'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`each'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`constantize'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.13/lib/active_support/core_ext/string/inflections.rb:54:in
`constantize'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/inflections.rb:123:in
`constantize'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:52:in
`block in associated_class'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:280:in
`block (2 levels) in cached_fetch'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:280:in
`fetch'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:280:in
`block in cached_fetch'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:278:in
`fetch'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:278:in
`cached_fetch'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/sequel-3.46.0/lib/sequel/model/associations.rb:52:in
`associated_class'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/model/sequel.rb:32:in
`scaffold_associated_class'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_model.rb:173:in
`scaffold_association_use_auto_complete'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/overridable.rb:55:in
`block (2 levels) in scaffold_override_iv_methods'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_model.rb:178:in
`block in scaffold_auto_complete_associations'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_model.rb:178:in
`reject'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_model.rb:178:in
`scaffold_auto_complete_associations'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_controller.rb:60:in
`scaffold'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_controller.rb:210:in
`block in scaffold_all_models'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_controller.rb:209:in
`collect'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/scaffolding_extensions-1.6.0/lib/scaffolding_extensions/meta_controller.rb:209:in
`scaffold_all_models'
from
/Library/WebServer/Documents/diaspora/app/controllers/admin_controller.rb:3:in
`<class:AdminController>'
from
/Library/WebServer/Documents/diaspora/app/controllers/admin_controller.rb:1:in
`<top (required)>'
from (irb):14
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in
`start'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in
`start'
from
/HOME_DIR/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.13/lib/rails/commands.rb:41:in
`<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3p286
On Friday, April 26, 2013 2:20:23 PM UTC-7, Jeremy Evans wrote:
>
> On Friday, April 26, 2013 12:27:16 PM UTC-7, Gabriel Correa wrote:
>>
>> Currently it just looks like this:
>>
>> class AdminController < ActionController::Base
>>
>> scaffold_all_models
>>
>> end
>>
>> The final line of output from `rake routes` is:
>> /:controller(/:action(/:id))(.:format) :controller#:action
>>
>
> That looks like it should work. In my rails apps that use scaffolding
> extensions, I'm using one of the following:
>
> match ':controller(/:action(/:id(.:format)))'
> match ':controller(/:action(/:id))'
>
> But I don't see a reason for those to work and yours to fail.
>
> Can you recreate this issue on a fresh Rails app? Is
> AdminController.method_defined?('index') true?
>
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.