Class: PanelRevision

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/panel_revision.rb

Overview

PanelRevision

PanelRevision contient l’historique de toutes les information clés composant un panneau à un instant donné dans Second Life. A chaque fois que le panneau est mis à jour, une copie est stockée dans PanelRevision.

Schema Information

Schema version: 13

Table name: panel_revisions

panel_name       :string(64)    not null
panel_key        :string(36)    not null
furniture_name   :string(64)    not null
furniture_key    :string(36)    not null
network_name     :string(64)    not null
network_status   :boolean(1)    
texture_name     :string(64)    not null
texture_key      :string(36)    not null
landmark_name    :string(64)    not null
landmark_key     :string(36)    not null
notecard_name    :string(64)    not null
notecard_key     :string(36)    not null
url_name         :string(64)    not null
url_content      :text          
mediaurl_name    :string(64)    not null
mediaurl_content :text          
created_at       :datetime

Class Method Summary collapse

Class Method Details

.add(panel) ⇒ Object

Création d’une nouvelle révision



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'app/models/panel_revision.rb', line 85

def self.add(panel)
  # On n'enregistre pas un panneau non finalisé
  return nil if panel.new_record?
  
  network = panel.network
  furniture = panel.furniture
  texture = panel.texture
  landmark = panel.landmark
  notecard = panel.notecard
  url = panel.url
  mediaurl = panel.mediaurl
  self.create!(:panel_name     => panel.name,                             :panel_key        => panel.panel_key,
               :furniture_name => furniture.name,                         :furniture_key    => furniture.furniture_key,
               :network_name   => (network.nil?  ? nil : network.name),   :network_status   => (network.nil?  ? nil : network.active),
               :texture_name   => (texture.nil?  ? nil : texture.name),    :texture_key      => (texture.nil?  ? nil : texture.object_key),
               :landmark_name  => (landmark.nil? ? nil : landmark.name),  :landmark_key     => (landmark.nil? ? nil : landmark.object_key),
               :notecard_name  => (notecard.nil? ? nil : notecard.name),  :notecard_key     => (notecard.nil? ? nil : notecard.object_key),
               :url_name       => (url.nil? ?      nil : url.name ),      :url_content      => (url.nil? ?      nil : url.content),
               :mediaurl_name  => (mediaurl.nil? ? nil : mediaurl.name ), :mediaurl_content => (mediaurl.nil? ? nil : mediaurl.content),
               :sim            => furniture.sim,                          :position         => furniture.position,
               :permanent_id   => furniture.permanent_id
               )
end