Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails scope alias

class User < ActiveRecord::Base
  scope :with_zipcode, lambda { |zip| where(zipcode: zip) }
  singleton_class.send(:alias_method, :has_zipcode, :with_zipcode)
end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #scope #alias
ADD COMMENT
Topic
Name
8+3 =