Advertisement
vsokoltsov

Untitled

Jan 15th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. validate :valid_users_structure?, if: -> { @users_attribute_is_array }
  2.  
  3. def users_attribute_is_array?
  4. if users.class == Array
  5. @users_attribute_is_array = true
  6. true
  7. else
  8. errors.add(:users, 'Is not an array')
  9. false
  10. end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement