Sha256: f26ccf96d9952c2713f998d490ff37af7655a63d95cfdffa7cd8163235168ec4

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

class TaliaSource < ActiveRecord::Base
  hobo_model # Don't put anything above this
  
  self.inheritance_column = 'foo'
  
  fields do
    uri :string
    type :string
  end
  
  set_table_name "active_sources"
  
  def create_permitted?
    acting_user.administrator?
  end
  
  def update_permitted?
    acting_user.administrator?
  end
  
  def view_permitted?(field)
    true
  end

  def name
    real_source.respond_to?(:label) ? real_source.label : to_uri.to_name_s
  end
  
  def short_type
    self.type ? self.type.gsub('TaliaCore::', '') : 'ActiveSource'
  end
  
  def to_uri
    N::URI.new(self.uri)
  end

  def real_source
    @real_source ||= TaliaCore::ActiveSource.find(self.id, :prefetch_relations => true)
  end
  
  

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
talia_core-0.7.0 generators/talia_admin/templates/app/models/talia_source.rb
talia_core-0.5.4 generators/talia_admin/templates/app/models/talia_source.rb
talia_core-0.5.3 generators/talia_admin/templates/app/models/talia_source.rb
talia_core-0.5.2 generators/talia_admin/templates/app/models/talia_source.rb
talia_core-0.5.1 generators/talia_admin/templates/app/models/talia_source.rb
talia_core-0.5.0 generators/talia_admin/templates/app/models/talia_source.rb