From 97b483031d188bd4a6d16882dd0415dc45c193b9 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Fri, 5 Aug 2016 20:56:04 -0400 Subject: [PATCH] Update payment.rb --- app/models/payment.rb | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/app/models/payment.rb b/app/models/payment.rb index bbb7530..85a9b8a 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -8,23 +8,15 @@ # #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -require 'active_record/validations' - class Payment unloadable - # Mix in that validation goodness! - include ActiveRecord::Validations + include ActiveModel::Model attr_accessor :errors, :customer_id, :account_id, :payment_method_id, :total_amount validates_presence_of :customer_id, :account_id, :payment_method_id, :total_amount validates :total_amount, numericality: true - def initialize(opts = {}) - # Create an Errors object, which is required by validations and to use some view methods. - @errors = ActiveRecord::Errors.new(self) - end - def save # TODO Save the payment end @@ -32,12 +24,7 @@ class Payment def save! # TODO Save! the payment end - - # Dummy stub to make validtions happy. - def new_record? - true - end - + # Dummy stub to make validtions happy. def update_attribute end @@ -45,9 +32,5 @@ class Payment def new # TODO things & stuff end - - def create - # TODO more things - end - + end