# If you need to execute a block of code you can use the following syntax scope :by_status, (lambda do |status| where(:active => status) unless status.blank? end)
#Active users pry(main)> User.by_status(1) SELECT `users`.* FROM `users` WHERE `users`.`active` = 1
#Inactive users pry(main)> User.by_status(0) SELECT `users`.* FROM `users` WHERE `users`.`active` = 0
#All users pry(main)> User.by_status(nil) SELECT `users`.* FROM `users`