mardi 3 avril 2018

How to get all records with specific enum in a simple_enum rails 3

spotlight.rb

as_enum :media_type, :image => 0,:video => 1

When I do

Spotlight.last.media_type

return nil. But when I do

 Spotlight.last.image?

it returns true

2nd issue is that it not returns list of all records when I do

Spotlight.images
Spotlight.videos

Aucun commentaire:

Enregistrer un commentaire