I have the following Code
@venue = Venue.friendly.find(params[:id])
@venues_nearby = Venue.within(100, :origin => [@venue.lat, @venue.lng]).where(:id != @venue.id)
I want to exclude the Record @venue.id
Is there any way to chain the same with the .within
method?
"within" returns a scope so you can do this using normal arel where:
Location.within(3.9, origin: @loc_a).where("id != #{@loc_e.id}")
If you want a nicer syntax like you had you could use the squeel gem to get:
Location.within(3.9, origin: @loc_a).where{ id != @loc_e.id }