Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Rules: Alphabetize `<select>`s in new rule form (#280)

Dylan Corralesb4e4c3783463
diff --git a/app/models/rule/action_executor/set_transaction_category.rb b/app/models/rule/action_executor/set_transaction_category.rb
index 6360e45a28..2da95bbac4 100644
--- a/app/models/rule/action_executor/set_transaction_category.rb
+++ b/app/models/rule/action_executor/set_transaction_category.rb
@@ -4,7 +4,7 @@ class Rule::ActionExecutor::SetTransactionCategory < Rule::ActionExecutor
end
def options
- family.categories.pluck(:name, :id)
+ family.categories.alphabetically.pluck(:name, :id)
end
def execute(transaction_scope, value: nil, ignore_attribute_locks: false)
diff --git a/app/models/rule/action_executor/set_transaction_merchant.rb b/app/models/rule/action_executor/set_transaction_merchant.rb
index f343a79f71..f9693ddacc 100644
--- a/app/models/rule/action_executor/set_transaction_merchant.rb
+++ b/app/models/rule/action_executor/set_transaction_merchant.rb
@@ -4,7 +4,7 @@ class Rule::ActionExecutor::SetTransactionMerchant < Rule::ActionExecutor
end
def options
- family.merchants.pluck(:name, :id)
+ family.merchants.alphabetically.pluck(:name, :id)
end
def execute(transaction_scope, value: nil, ignore_attribute_locks: false)
diff --git a/app/models/rule/action_executor/set_transaction_tags.rb b/app/models/rule/action_executor/set_transaction_tags.rb
index d74029ca1e..f317f9602b 100644
--- a/app/models/rule/action_executor/set_transaction_tags.rb
+++ b/app/models/rule/action_executor/set_transaction_tags.rb
@@ -4,7 +4,7 @@ class Rule::ActionExecutor::SetTransactionTags < Rule::ActionExecutor
end
def options
- family.tags.pluck(:name, :id)
+ family.tags.alphabetically.pluck(:name, :id)
end
def execute(transaction_scope, value: nil, ignore_attribute_locks: false)
diff --git a/app/models/rule/condition_filter/transaction_merchant.rb b/app/models/rule/condition_filter/transaction_merchant.rb
index db1522268f..581db1cdf0 100644
--- a/app/models/rule/condition_filter/transaction_merchant.rb
+++ b/app/models/rule/condition_filter/transaction_merchant.rb
@@ -4,7 +4,7 @@ class Rule::ConditionFilter::TransactionMerchant < Rule::ConditionFilter
end
def options
- family.assigned_merchants.pluck(:name, :id)
+ family.assigned_merchants.alphabetically.pluck(:name, :id)
end
def prepare(scope)