update mapper declaration

arnaud sellenet committed Jun 16, 2014
commit 69a0a14c24400ba289a200fb87765c398aad4161
Showing 3 changed files with 7 additions and 5 deletions
locomotive/steam/entities/page.rb b/lib/locomotive/steam/entities/page.rb +2 -1
@@ @@ -8,7 +8,8 @@ module Locomotive
attributes :parent, :title, :slug, :fullpath, :redirect_url, :redirect_type,
:template, :handle, :listed, :searchable, :templatized, :content_type,
:published, :cache_strategy, :response_type, :position, :seo_title,
- :meta_keywords, :meta_description, :editable_elements, :site
+ :meta_keywords, :meta_description, :editable_elements, :site, :site_id,
+ :parent_id
## aliases ##
alias :listed? :listed
locomotive/steam/mapper.rb b/lib/locomotive/steam/mapper.rb +4 -4
@@ @@ -22,9 +22,9 @@ collection :pages do
entity Locomotive::Steam::Entities::Page
repository Locomotive::Steam::Repositories::PagesRepository
- attribute :site, association: :sites
- attribute :content_type, association: :content_types
- attribute :parent, association: :pages
+ attribute :site, association: {type: :belongs_to, key: :site_id, name: :sites}
+ attribute :content_type, association: {type: :belongs_to, key: :content_type_id, name: :content_types}
+ attribute :parent, association: {type: :belongs_to, key: :parent_id, name: :pages}
attribute :title, localized: true
attribute :slug, localized: true
attribute :fullpath, localized: true
@@ @@ -53,7 +53,7 @@ collection :content_types do
entity Locomotive::Steam::Entities::ContentType
repository Locomotive::Steam::Repositories::ContentTypesRepository
attribute :slug
- attribute :site, association: :sites
+ attribute :site, association: {type: :belongs_to, key: :site_id, name: :sites}
end
collection :content_entries do
locomotive/steam/server.rb b/lib/locomotive/steam/server.rb +1 -0
@@ @@ -5,6 +5,7 @@ require_relative 'services'
require_relative 'middlewares'
require 'locomotive/models'
+ require 'locomotive/decorators'
module Locomotive::Steam
class Server