Sha256: 088b7d3e9e3513b9ba74ede5b39017e02730547784b9d4dd87482df646ce3848

Contents?: true

Size: 392 Bytes

Versions: 19

Compression:

Stored size: 392 Bytes

Contents

# Used for link-methods in Rails apps
class Baza::DatabaseModel
  def initialize(instance)
    @instance = instance
  end

  def model_name
    Baza::DatabaseModelName.new(@instance)
  end

  def persisted?
    true
  end

  def to_param
    if @instance.respond_to?(:to_param)
      @instance.try(:to_param)
    else
      @instance.name
    end
  end

  def id
    @instance.name
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
baza-0.0.38 lib/baza/database_model.rb
baza-0.0.37 lib/baza/database_model.rb
baza-0.0.36 lib/baza/database_model.rb
baza-0.0.35 lib/baza/database_model.rb
baza-0.0.34 lib/baza/database_model.rb
baza-0.0.33 lib/baza/database_model.rb
baza-0.0.32 lib/baza/database_model.rb
baza-0.0.31 lib/baza/database_model.rb
baza-0.0.30 lib/baza/database_model.rb
baza-0.0.29 lib/baza/database_model.rb
baza-0.0.28 lib/baza/database_model.rb
baza-0.0.27 lib/baza/database_model.rb
baza-0.0.26 lib/baza/database_model.rb
baza-0.0.25 lib/baza/database_model.rb
baza-0.0.24 lib/baza/database_model.rb
baza-0.0.23 lib/baza/database_model.rb
baza-0.0.22 lib/baza/database_model.rb
baza-0.0.21 lib/baza/database_model.rb
baza-0.0.20 lib/baza/database_model.rb