mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
add namespaced samples
This commit is contained in:
parent
ad94f54369
commit
1c3d5667b8
2 changed files with 58 additions and 0 deletions
51
spec/support/samples/namespaced_product.rb
Normal file
51
spec/support/samples/namespaced_product.rb
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
require './spec/support/samples/product'
|
||||||
|
|
||||||
|
module Namespace
|
||||||
|
class Product < ActiveRecord::Base
|
||||||
|
include Draper::ModelSupport
|
||||||
|
|
||||||
|
def self.first
|
||||||
|
@@first ||= Namespace::Product.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.last
|
||||||
|
@@last ||= Namespace::Product.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.all
|
||||||
|
[Namespace::Product.new, Namespace::Product.new]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.scoped
|
||||||
|
[Namespace::Product.new]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.model_name
|
||||||
|
"Namespace::Product"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.find(id)
|
||||||
|
return Namespace::Product.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.sample_class_method
|
||||||
|
"sample class method"
|
||||||
|
end
|
||||||
|
|
||||||
|
def hello_world
|
||||||
|
"Hello, World"
|
||||||
|
end
|
||||||
|
|
||||||
|
def goodnight_moon
|
||||||
|
"Goodnight, Moon"
|
||||||
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
"Sample Title"
|
||||||
|
end
|
||||||
|
|
||||||
|
def block
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
spec/support/samples/namespaced_product_decorator.rb
Normal file
7
spec/support/samples/namespaced_product_decorator.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require './spec/support/samples/product'
|
||||||
|
|
||||||
|
module Namespace
|
||||||
|
class ProductDecorator < Draper::Base
|
||||||
|
decorates :product, :class => Namespace::Product
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue