class Post < ActiveRecord::Base
attr_accessible :type
end
class Link < Post
end
irb(main):012:0> User.first.up_vote! Link.first
INSERT INTO votings (created_at, up_vote, updated_at, voteable_id, voteable_type, voter_id, voter_type) VALUES ('2012-10-14 07:15:41', 1, '2012-10-14 07:15:41', 62, 'Post', 1, 'User')
irb(main):013:0> User.first.up_voted? Link.first
MakeVoteable::Voting Load (0.3ms) SELECT votings.* FROM votings WHERE votings.voteable_type = 'Link' AND votings.voteable_id = 62 AND votings.voter_type = 'User' AND votings.voter_id = 1 LIMIT 1
=> false
class Post < ActiveRecord::Base
attr_accessible :type
end
class Link < Post
end
irb(main):012:0> User.first.up_vote! Link.first
INSERT INTO
votings(created_at,up_vote,updated_at,voteable_id,voteable_type,voter_id,voter_type) VALUES ('2012-10-14 07:15:41', 1, '2012-10-14 07:15:41', 62, 'Post', 1, 'User')irb(main):013:0> User.first.up_voted? Link.first
MakeVoteable::Voting Load (0.3ms) SELECT
votings.* FROMvotingsWHEREvotings.voteable_type= 'Link' ANDvotings.voteable_id= 62 ANDvotings.voter_type= 'User' ANDvotings.voter_id= 1 LIMIT 1=> false