Sha256: 19d623745befe96f492390d7682d93491af521086877e595593196b9e0a850a4

Contents?: true

Size: 856 Bytes

Versions: 3

Compression:

Stored size: 856 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

3 entries across 3 versions & 1 rubygems

Version Path
sinatra_resource-0.4.24 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.4.23 examples/datacatalog/resources/categories_sources.rb
sinatra_resource-0.4.22 examples/datacatalog/resources/categories_sources.rb