Skip to content

Commit

Permalink
Delegate firstname and lastname to bill_address instead of creating s…
Browse files Browse the repository at this point in the history
…eparate methods
  • Loading branch information
tanmay3011 committed Dec 2, 2015
1 parent 10ea458 commit fb7a278
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def states

make_permalink field: :number

delegate :update_totals, :persist_totals, :to => :updater
delegate :update_totals, :persist_totals, to: :updater
delegate :firstname, :lastname, to: :bill_address, prefix: true, allow_nil: true
alias_method :billing_firstname, :bill_address_firstname
alias_method :billing_lastname, :bill_address_lastname


class_attribute :update_hooks
self.update_hooks = Set.new
Expand Down Expand Up @@ -410,14 +414,6 @@ def available_payment_methods
).uniq
end

def billing_firstname
bill_address.try(:firstname)
end

def billing_lastname
bill_address.try(:lastname)
end

def insufficient_stock_lines
line_items.select(&:insufficient_stock?)
end
Expand Down

1 comment on commit fb7a278

@cbrunsdon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.