Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Question
- How should I check that user all ready marked that video as his favorite movie?
- ## Console
- ernest@ernest-desktop:~/Dokumenty/Projekty/bort$ script/console
- Loading development environment (Rails 2.2.2)
- >> user = User.find(1)
- => #<User id: 1, login: "admin", identity_url: nil, name: "", email: "ernest@bzdury.pl", crypted_password: "0c44be210a97ef8d33ea74891259cbe4a5608d27", salt: "9ca6558e60dd209b45e96edd61cd9b25182a4d74", remember_token: nil, activation_code: nil, state: "active", last_active: "2009-01-09 14:56:06", remember_token_expires_at: nil, activated_at: "2009-01-09 13:56:11", deleted_at: nil, created_at: "2009-01-09 13:56:06", updated_at: "2009-01-09 13:56:11">
- >> movie = Movie.find(:first)
- => #<Movie id: 1, title: "Sunrise", display_counter: 34>
- >> movie.favorites
- => [#<Favorite id: 1, favoritable_id: 1, favoritable_type: "Movie", user_id: 1, created_at: "2009-01-09 13:57:22", updated_at: "2009-01-09 13:57:22">]
- >> movie.favorites.include?(user)
- => false
Add Comment
Please, Sign In to add comment