This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because of the way I've structure the requests model and it's relationship with ads, I need to be able to do ORs in my query. | |
Anyway I've found my way to Arel and it looks like it should do the goods for me but I can't get a join working | |
The existing named scope in the Request class is | |
scope :responder, lambda { |user| joins(:ad).where(:ads => { :user_id => user }) } | |
The above works as I expect it to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#./lib/generators/tester | |
# shows in generator list as | |
class TesterGenerator < Rails::Generators::NamedBase | |
source_root File.expand_path('../templates', __FILE__) | |
end | |
# $ rails g | |
# Usage: rails generate GENERATOR [args] [options] | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# paste this into the console to see the results are sometimes good and then sometimes the error | |
# Math::DomainError: Numerical argument is out of domain - "acos" | |
# Error ref - http://www.ruby-doc.org/core-1.9.3/Math/DomainError.html | |
@loc1 = FactoryGirl.create(:location) | |
Location.all.each do |location| | |
location.nearby?(@loc1) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Controller | |
class BagsController < ApiController | |
# .... | |
def index | |
authorize_action_for(Bag) | |
end | |
# .... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Launch", | |
"type": "go", | |
"request": "launch", |