Class: SakaiInfo::PageProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/sakai-info/page.rb

Class Method Summary collapse

Class Method Details

.find_by_page_id(page_id) ⇒ Object



106
107
108
109
110
111
112
113
# File 'lib/sakai-info/page.rb', line 106

def self.find_by_page_id(page_id)
  properties = {}
  DB.connect[:sakai_site_page_property].
    where(:page_id => page_id).all.each do |row|
    properties[row[:name]] = row[:value].read
  end
  return properties
end

.get(page_id, property_name) ⇒ Object



96
97
98
99
100
101
102
103
104
# File 'lib/sakai-info/page.rb', line 96

def self.get(page_id, property_name)
  row = DB.connect[:sakai_site_page_property].
    filter(:page_id => page_id, :name => property_name).first
  if row.nil?
    nil
  else
    row[:value].read
  end
end