Skip to content

Instantly share code, notes, and snippets.

@aquajach
Last active April 28, 2017 05:33
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 aquajach/bc7fc43c5ab43d068ea40f095f3e107c to your computer and use it in GitHub Desktop.
Save aquajach/bc7fc43c5ab43d068ea40f095f3e107c to your computer and use it in GitHub Desktop.
Code smells
((total_scans*1.0)/total_campaign_members).round(1)
#=>
((total_scans * 1.0) / total_campaign_members).round(1)
validates_numericality_of :transaction_unit, 'greater_than' => 0, 'allow_nil' => true
#=>
validates_numericality_of :transaction_unit, greater_than: 0, allow_nil: true
WechatMessageJob.perform_later({openid: openid, article: wechat_article })
#=>
WechatMessageJob.perform_later(openid: openid, article: wechat_article)
if hookable.pass_type == 'coupon'
if self.respond_to? :gift_histories
Pass.create_or_update(self.gift_histories.first, hookable)
end
else
if self.respond_to? :point_history
Pass.create_or_update(campaign_member, hookable, self.point_history.point_pool)
else
Pass.create_or_update(campaign_member, hookable)
end
end
#=>
if hookable.pass_type == 'coupon'
if self.respond_to? :gift_histories
Pass.create_or_update(self.gift_histories.first, hookable)
end
elsif self.respond_to? :point_history
Pass.create_or_update(campaign_member, hookable, self.point_history.point_pool)
else
Pass.create_or_update(campaign_member, hookable)
end
point_requirement.requirement if point_requirement
#=>
point_requirement&.requirement
strip.gsub(' ', '_')
#=>
strip.tr(' ', '_')
raise LoopException::ValidationError.new(gift_rule.errors)
#=>
raise LoopException::ValidationError, gift_rule.errors
"#{stats[:count]}"
#=>
stats[:count].to_s
if ((self.place % self.every_count) == 0)
end
#=>
if (self.place % self.every_count) == 0
end
class CampaignMember < ActiveRecord::Base
QueryLimit = 100
end
#=>
class CampaignMember < ActiveRecord::Base
QUERY_LIMIT = 100
end
File.join(Rails.root, 'spec/files/icon.png')
#=>
Rails.root.join('spec', 'files', 'icon.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment