Have a query that is failing because the scope is running a query like this :'%'email'%'
The internal quotes are causing the problem, how can I get rid of them?
user.rb (User Model)
#it's checking a text field to see if it contains the email address
@locations = Location.has_permission(self.email)
location.rb (Location Model)
scope :has_permission, lambda { |email| where("locations.permissions LIKE '%?%'",email)}
scope :has_permission,
lambda { |email| where("locations.permissions LIKE ?", "%#{email}%") }
There's a way to do this with AREL, too, with a matches("%#{email}%") but I'm not sure of the syntax to get to the nested permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With