Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## user.rb model
- class User < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :http_authenticatable, :token_authenticatable, :confirmable, :lockable, :timeouta
- devise :registerable,
- :database_authenticatable,
- :recoverable,
- #:rememberable,
- :trackable,
- :validatable
- # Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :username, #core in the
- :givenName, :sn # "virtual for ldap"
- before_create :try_add_ldap
- before_update :try_update_ldap
- before_destroy :try_destroy_ldap
- private
- def pass_ssha(password)
- ActiveLdap::UserPassword.ssha(password)
- end
- def try_add_ldap
- ldap = LdapUser.new(:uid => self.username,
- :givenName => self.givenName,
- :cn => "#{self.givenName} #{self.sn}",
- :sn => self.sn,
- :mail => "#{self.username}@empiregameleague.com",
- :physicalDeliveryOfficeName => self.email,
- :userPassword => pas_ssha(self.password)
- )
- if ldap.save
- return true
- else
- errors.add(:ldap, "user was not able to be written")
- return false
- end
- end
- ## eNoMethodError in Registrations#new
- Showing app/views/registrations/new.html.haml where line #12 raised:
- undefined method `givenName' for #<User:0x7f7f1b4511f8>
- Extracted source (around line #12):
- 9: = f.input :password_confirmation
- 10: = f.inputs :name => "Personal Information", :id => "personal" do
- 11: = f.input :givenName
- 12: = f.input :sn
- 13: = f.buttons
- 14: = render :partial => "shared/devise_links"
- RAILS_ROOT: /var/www/rails/rubyportal
- Application Trace | Framework Trace | Full Trace
- Request
- Parameters:
- None
- Show session dump
- Response
- Headers:
- {"Content-Type"=>"text/html",
- "Cache-Control"=>"no-cache"}
- rror
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement