Keep your code, yourself and team Happy :)
#A dirty one knows too much.
class Bank < ActiveRecord::Base
def i_give_most_valued_customers
#it will have business logic for valued customers
end
def i_give_employee_performance
#It will have business Logic for getting employee performance
end
end
#A dirty one knows too much.
class Bank < ActiveRecord::Base
include IGiveMostValuedCustomers
include IGiveEmployeePerformance
end
Example Here
Let classes talk to Modules
#A dirty one knows too much. class PurchasesController < ApplicationController before :i_will_do_x before :i_will_do_y before :i_will_do_z end class AcknowledgementsController < ApplicationController before :i_will_do_y before :i_will_do_z end
class PurchasesController < ApplicationController ask_manager(controller_name) end class AcknowledgementsController < ApplicationController ask_manager(controller_name) end
module Manager
def i_am_for_purchases
before :i_will_do_x
before :i_will_do_y
before :i_will_do_z
end
def i_am_for_acknowledgements
before :i_will_do_y
before :i_will_do_z
end
def ask_manager(controller)
send("i_am_for_#{controller}")
end
end
Example Here
Comments, valid method names & Examples
Example AR - Rails Example AM - Rails RedE CodeExtract out common methods - helpers - Fixtures in Modules
RSpec.configure do |config|
config.include MockHistoricalData::CaseA
config.include MockHistoricalData::CaseB
config.include LocaleSwitcher
end
Example 1 - Mock Data & Usage Example 2 - Locale Switch & Usage
web: bundle exec rails server sidekiq: bundle exec sidekiq -L log/sidekiq.log redis: redis-serverHave Faster tests with Zeus Search for testing frameworks with Popular libraries. Eg shoulda-callbacks-matchers & rspec-sidekiq