From dc99dbb0afb1a6e220ff7704d0fed493316a9623 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Tue, 2 Jan 2024 16:08:28 +0530 Subject: [PATCH] use `#invert` & `#to_a` to return array of collection --- app/views/sabeels/_form.html.erb | 2 +- app/views/thaalis/_form.html.erb | 2 +- app/views/transactions/_form.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/sabeels/_form.html.erb b/app/views/sabeels/_form.html.erb index 003526ba..eadd65fd 100644 --- a/app/views/sabeels/_form.html.erb +++ b/app/views/sabeels/_form.html.erb @@ -3,7 +3,7 @@ <%= f.error_notification %> <%= f.input :its %> <%= f.input :name, placeholder: "Juzer Shabbir Shakir" %> - <%= f.input :apartment, collection: collection_of(Sabeel.apartments), as: :radio_buttons %> + <%= f.input :apartment, collection: Sabeel.apartments.invert.to_a, as: :radio_buttons %> <%= f.input :flat_no %> <%= f.input :mobile, placeholder: "9876543210" %> <%= f.input :email %> diff --git a/app/views/thaalis/_form.html.erb b/app/views/thaalis/_form.html.erb index 45b2cc44..7fab3c2c 100644 --- a/app/views/thaalis/_form.html.erb +++ b/app/views/thaalis/_form.html.erb @@ -4,7 +4,7 @@ <%= f.input :year, disabled: true %> <%= f.input :number %> - <%= f.input :size, collection: collection_of(Thaali.sizes), as: :radio_buttons %> + <%= f.input :size, collection: Thaali.sizes.invert.to_a, as: :radio_buttons %> <%= f.input :total, disabled: action_name == "edit" %> <%= f.button :submit, action_name: %> <% end %> diff --git a/app/views/transactions/_form.html.erb b/app/views/transactions/_form.html.erb index 0949a225..2c9c8518 100644 --- a/app/views/transactions/_form.html.erb +++ b/app/views/transactions/_form.html.erb @@ -3,7 +3,7 @@ <%= f.error_notification %> <%= f.input :recipe_no %> <%= f.input :amount, hint: "Amount shouldn't be greater than: ₹#{total_balance}" %> - <%= f.input :mode, collection: collection_of(Transaction.modes), as: :radio_buttons %> + <%= f.input :mode, collection: Transaction.modes.invert.to_a, as: :radio_buttons %> <%= f.input :date, order: %i[day month year] %> <%= f.button :submit, action_name: %> <% end %>