mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
5ffaaa71d1
- Define to_model on AR - Define to_model on ActiveModel::APICompliant - Update test fixtures to be API Compliant - Start using to_model in AP
25 lines
348 B
Ruby
25 lines
348 B
Ruby
require "active_model"
|
|
|
|
class Customer < Struct.new(:name, :id)
|
|
extend ActiveModel::APICompliant
|
|
|
|
def to_param
|
|
id.to_s
|
|
end
|
|
end
|
|
|
|
class BadCustomer < Customer
|
|
end
|
|
|
|
class GoodCustomer < Customer
|
|
end
|
|
|
|
module Quiz
|
|
class Question < Struct.new(:name, :id)
|
|
extend ActiveModel::APICompliant
|
|
|
|
def to_param
|
|
id.to_s
|
|
end
|
|
end
|
|
end
|