Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix standardrb violations #96

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion lib/solidus_friendly_promotions/promotion_migrator.rb
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