
CC Evans
Joined
20 Experience
0 Lessons Completed
0 Questions Solved
Activity
Posted in Advanced Search, Autocomplete and Suggestions with ElasticSearch and the Searchkick gem Discussion
How would I apply a scope? Like one of these.
scope :draft, ->{where(published_at: nil)}
scope :published, ->{where.not(published_at: nil).where("published_at <= ?", Time.now.in_time_zone("Eastern Time (US & Canada)"))}
scope :scheduled, ->{where.not(published_at: nil).where("published_at >= ?", Time.now.in_time_zone("Eastern Time (US & Canada)"))}
scope :pastevent, ->{where("event_end <= ?", Time.now.in_time_zone("Eastern Time (US & Canada)"))}
Posted in Advanced Search, Autocomplete and Suggestions with ElasticSearch and the Searchkick gem Discussion
How would I search a Post model where I wanted only see published post? Can't figure out how the code should look in the controller index.