Skip to content

Instantly share code, notes, and snippets.

@BillyParadise
Created July 6, 2016 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BillyParadise/845920e8046d10084b3b54e8fe6cfb3c to your computer and use it in GitHub Desktop.
Save BillyParadise/845920e8046d10084b3b54e8fe6cfb3c to your computer and use it in GitHub Desktop.
Model:
class Profile < ApplicationRecord {
... => ...
:plan_id => :integer,
:requestedplan => :integer
}
class Profile < ApplicationRecord
belongs_to :plan
scope :notnil, -> { where.not(requestedplan: nil)}
scope :changereq, -> { notnil.where('requestedplan != plan_id')} #***
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment