Colin Law wrote in post #1054363:
> On 29 March 2012 17:17, bingo bob <lists@ruby-forum.com> wrote:
>>
>> devise :database_authenticatable, :registerable,
>> NameError: uninitialized constant User::UserName
> What is that ORDER BY lower(username) doing? I don't see where that
> is coming from in your code.
>
> What happens if you do User.first
>
> Colin
In the User model I have...
default_scope order('lower(username) ASC')
however commenting it out didn't help much.
User.first is/was fine...
User Load (0.6ms) SELECT "users".* FROM "users" LIMIT 1
=> #<User id: 34, email: "s.e.... bla bla
User.first.names
ruby-1.9.2-p290 :008 > User.first.names
User Load (0.6ms) SELECT "users".* FROM "users" LIMIT 1
NameError: uninitialized constant User::UserName
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/inheritance.rb:119:in
`compute_type'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/reflection.rb:172:in
`klass'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/reflection.rb:385:in
`block in source_reflection'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/reflection.rb:385:in
`collect'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/reflection.rb:385:in
`source_reflection'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/reflection.rb:508:in
`check_validity!'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/association.rb:26:in
`initialize'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb:24:in
`initialize'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/has_many_through_association.rb:10:in
`initialize'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations.rb:157:in
`new'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations.rb:157:in
`association'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/builder/association.rb:44:in
`block in define_readers'
from (irb):8
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in
`start'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in
`start'
from
/Users/rupert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands.rb:41:in
`<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'ruby-1.9.2-p290 :009 >
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment