*class SystemAdmin < ActiveRecord::Base* * belongs_to :user* *end* * * *class User < ActiveRecord::Base* * has_secure_password* * * * has_one :system_admin * *end* * * *@user = User.find_by_user_name(user_name)* * if [email protected]_admins.nil?* * puts 'am a sys_admin'* * * The above code gives error like this * * NoMethodError (undefined method `system_admins' for #<User:0xa81a2e0>): app/controllers/application_controller.rb:17:in `user_authenticate'
Have any problem with this condition checking* if [email protected]_admins.nil? *also any problem with the model relation? * * * * * * *Thank you* *vishnu* * * * * -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/FhRZVfzMTtMJ. 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/rubyonrails-talk?hl=en.

