Argument Error: The scope body needs to be callable

The scope's body needs to be wrapped in something callable like a Proc or Lambda:

scope :visible, -> {
  where(:visible => true)
}

The reason for this is that it ensures the contents of the block is evaluated each time the scope is used.


Yes, indeed, this is rails 4 way of calling scopes. You'd need to change it, if you're upgrading to Rails 4 from Rails 3.


I got the same error , while before my solution I had a space between where and ( like below

scope :registered , -> { where ( place_id:  :place_id , is_registered: :true ) }

after i removed the space between where and ( like below i made my page working

scope :registered , -> { where( place_id:  :place_id , is_registered: :true ) }