aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/test/lib/controller/fake_models.rb
blob: 0faf8f3f9a5044bfdcbbb368be9a3c47b3966586 (plain) (tree)
1
2
3
4
5
6
7
8

                      
                                       

                                 
 

                       


              















                
   





                             


                                         

                                   
 



                


                        
   
 
require "active_model"

class Customer < Struct.new(:name, :id)
  extend ActiveModel::Naming
  include ActiveModel::Conversion

  undef_method :to_json

  def to_param
    id.to_s
  end

  def to_xml
    "XML"
  end

  def to_js
    "JS"
  end

  def errors
    []
  end

  def destroyed?
    false
  end
end

class BadCustomer < Customer
end

class GoodCustomer < Customer
end

module Quiz
  class Question < Struct.new(:name, :id)
    extend ActiveModel::Naming
    include ActiveModel::Conversion

    def to_param
      id.to_s
    end
  end

  class Store < Question
  end
end