Sha256: abc4f578717e95a70770d0c1cdae015382b5f3e2b60ef00acdeca49984bae20a

Contents?: true

Size: 502 Bytes

Versions: 2

Compression:

Stored size: 502 Bytes

Contents

class BookingsController < HasAccountsController
  # Scopes
  has_scope :by_code
  has_scope :by_text
  has_scope :by_amount, :using => [:from, :to]
  has_scope :by_date, :using => [:from, :to]

  def create
    create! { new_booking_path }
  end

  def copy
    original_booking = Booking.find(params[:id])

    @booking = original_booking.dup
    increment_booking_code

    render 'edit'
  end

  private

  def increment_booking_code
    @booking.code = (Booking.maximum(:code) || 0) + 1
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
has_accounts_engine-3.0.0.beta15 app/controllers/bookings_controller.rb
has_accounts_engine-3.0.0.beta14 app/controllers/bookings_controller.rb