From 68982e4a960c379930224ec623b8258911979304 Mon Sep 17 00:00:00 2001 From: Peter Markou Date: Thu, 21 Aug 2014 17:47:57 +0300 Subject: [PATCH] Delegate getter and setter to model in a single line. --- lib/active_form/base.rb | 3 +-- lib/active_form/form.rb | 3 +-- lib/active_form/form_collection.rb | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/active_form/base.rb b/lib/active_form/base.rb index 02573c5..21f77bb 100644 --- a/lib/active_form/base.rb +++ b/lib/active_form/base.rb @@ -64,8 +64,7 @@ def attributes(*names) end names.each do |attribute| - delegate attribute, to: :model - delegate "#{attribute}=", to: :model + delegate attribute, "#{attribute}=", to: :model end end diff --git a/lib/active_form/form.rb b/lib/active_form/form.rb index 46a1333..b6e6d94 100644 --- a/lib/active_form/form.rb +++ b/lib/active_form/form.rb @@ -46,8 +46,7 @@ def attributes(*arguments) end arguments.each do |attribute| - delegate attribute, to: :model - delegate "#{attribute}=", to: :model + delegate attribute, "#{attribute}=", to: :model end end end diff --git a/lib/active_form/form_collection.rb b/lib/active_form/form_collection.rb index 28679f6..fe2f5cc 100644 --- a/lib/active_form/form_collection.rb +++ b/lib/active_form/form_collection.rb @@ -18,11 +18,7 @@ def update_models fetch_models end - - def submit(params) - #check_record_limit!(records, params) - params.each do |key, value| if parent.persisted? create_or_update_record(value)