Sha256: d85ba8a21cc007524de81af1d0ec84ae823c4a5ed1a658a98106b907bbec9d4d

Contents?: true

Size: 289 Bytes

Versions: 6

Compression:

Stored size: 289 Bytes

Contents

class HasOne < Struct.new(:klass, :model, :options)
  def inverse
    ActiveSupport::Inflector.underscore(klass.to_s.split('::').last)
  end

  def foreign_class
    options[:class] || Mailroute.const_get(ActiveSupport::Inflector.classify(model))
  end

  def pk
    options[:pk]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mailroute-0.0.6 lib/mailroute/extensions/active_resource/has_one.rb
mailroute-0.0.5 lib/mailroute/extensions/active_resource/has_one.rb
mailroute-0.0.4 lib/mailroute/extensions/active_resource/has_one.rb
mailroute-0.0.3 lib/mailroute/extensions/active_resource/has_one.rb
mailroute-0.0.2 lib/mailroute/extensions/active_resource/has_one.rb
mailroute-0.0.1 lib/mailroute/extensions/active_resource/has_one.rb