Skip to content

Commit

Permalink
Merge pull request #96 from friendlycart/fix-standard-issues
Browse files Browse the repository at this point in the history
Fix standardrb violations
  • Loading branch information
mamhoff authored Jan 16, 2024
2 parents 2cf34a1 + ec1cac4 commit 9dd9def
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def parent
@parent ||= self.class.parent_data[:model_class]
.includes(self.class.parent_data[:includes])
.find_by!(self.class.parent_data[:find_by] => params["#{parent_model_name}_id"])
instance_variable_set("@#{parent_model_name}", @parent)
instance_variable_set(:"@#{parent_model_name}", @parent)
rescue ActiveRecord::RecordNotFound => e
resource_not_found(flash_class: e.model.constantize, redirect_url: routes_proxy.polymorphic_url([:admin, parent_model_name.pluralize.to_sym]))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def model_class

def validate_promotion_rule_type
requested_type = params[:promotion_rule].delete(:type)
promotion_rule_types = SolidusFriendlyPromotions.config.send("#{@level}_rules")
promotion_rule_types = SolidusFriendlyPromotions.config.send(:"#{@level}_rules")
@promotion_rule_type = promotion_rule_types.detect do |klass|
klass.name == requested_type
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Admin
module PromotionRulesHelper
def options_for_promotion_rule_types(promotion_rule, level)
existing = promotion_rule.promotion.rules.select(&:persisted?).map { |rule| rule.class.name }
rules = SolidusFriendlyPromotions.config.send("#{level}_rules").reject { |rule| existing.include? rule.name }
rules = SolidusFriendlyPromotions.config.send(:"#{level}_rules").reject { |rule| existing.include? rule.name }
options = rules.map { |rule| [rule.model_name.human, rule.name] }
options_for_select(options, promotion_rule.type.to_s)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def applicable?(promotable)
end

def eligible?(promotable)
send("#{promotable.class.name.demodulize.underscore}_eligible?", promotable)
send(:"#{promotable.class.name.demodulize.underscore}_eligible?", promotable)
end

def level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def generate_new_promotion_rules(old_promotion_rule)
else
new_rule = new_promo_rule_class.new(old_promotion_rule.attributes.except(*PROMOTION_IGNORED_ATTRIBUTES))
new_rule.preload_relations.each do |relation|
new_rule.send("#{relation}=", old_promotion_rule.send(relation))
new_rule.send(:"#{relation}=", old_promotion_rule.send(relation))
end
[new_rule]
end
Expand Down

0 comments on commit 9dd9def

Please sign in to comment.