Sha256: 4deb40808a58ae65cc4dcec18aa049e91a37c594c403447ba911b9deb1fecff7

Contents?: true

Size: 870 Bytes

Versions: 29

Compression:

Stored size: 870 Bytes

Contents

module DataCatalog

  class CategoriesSources < Base
    include Resource

    parent Categories
    child_association :sources
    model Source
    path "sources"

    relation :create do |parent, child|
      Categorization.create(
        :category_id => parent.id,
        :source_id   => child.id
      )
    end
    
    relation :delete do |parent, child|
      Categorization.find(:conditions => {
        :category_id => parent.id,
        :source_id   => child.id
      }).destroy
    end

    # == Permissions

    roles Roles
    permission :list   => :basic
    permission :read   => :basic
    permission :create => :curator
    permission :update => :curator
    permission :delete => :curator
    
    # == Properties

    property :title
    property :url
    property :raw, :w => :admin

    # == Callbacks
    
  end
  
  CategoriesSources.build

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
sinatra_resource-0.4.1 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.4.0 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.6 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.5 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.4 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.3 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.2 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.1 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.3.0 examples/datacatalog/resources/categories_sources.rb