Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

parameterized scope rails code

scope :by_post_status, -> (post_status) { where('post_status = ?', post_status) }
scope :published, -> { by_post_status("public") }
scope :draft, -> { by_post_status("draft") }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #parameterized #scope #rails #code
ADD COMMENT
Topic
Name
3+8 =