Guest User

Untitled

a guest
Apr 14th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. Error message: User expected, got User
  2.  
  3. Hrrmmm. Add an inspect to those classes in the error message
  4.  
  5. def raise_on_type_mismatch(record)
  6. unless record.is_a?(@reflection.klass)
  7. raise ActiveRecord::AssociationTypeMismatch, "#{@reflection.klass.inspect} expected, got #{record.class.inspect}"
  8. end
  9. end
  10.  
  11.  
  12. ActiveRecord::AssociationTypeMismatch in PostsController#create
  13.  
  14. User(id: integer, username: string, crypted_password: string, salt: string, created_at: datetime, updated_at: datetime, remember_token: string, remember_token_expires_at: datetime, password_reset_code: string, primary_email_address_id: integer, full_name: string, gender: string, birthdate: datetime, headline: string, description: text, avatar_id: integer)
  15. expected, got
  16. User(id: integer, username: string, crypted_password: string, salt: string, created_at: datetime, updated_at: datetime, remember_token: string, remember_token_expires_at: datetime, password_reset_code: string, primary_email_address_id: integer, full_name: string, gender: string, birthdate: datetime, headline: string, description: text, avatar_id: integer)
  17.  
  18.  
  19. wtf?
Add Comment
Please, Sign In to add comment