diff options
| author | Luc Donnet | 2012-02-20 22:44:44 +0100 |
|---|---|---|
| committer | Luc Donnet | 2012-02-20 22:44:44 +0100 |
| commit | da3e849d4d89ffa3de2d370a30d3d5531b50ea5b (patch) | |
| tree | 26d0e12a135753d0acf4a59a7007006aac5e759a /app/models | |
| parent | a0823f387ddea69b0f207ba35165fcfd13b169d3 (diff) | |
| download | chouette-core-da3e849d4d89ffa3de2d370a30d3d5531b50ea5b.tar.bz2 | |
Add requests spec, Fix view
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/referential.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb index 430785470..a329bf950 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -2,9 +2,29 @@ class Referential < ActiveRecord::Base validates_presence_of :name validates_presence_of :slug + before_create :create_schema + before_destroy :destroy_schema + def lines Chouette::Line.all - end + end + + def networks + Chouette::Network.all + end + + def companies + Chouette::Company.all + end + + private + + def create_schema + Apartment::Database.create self.slug + end + def destroy_schema + Apartment::Database.drop self.slug + end end |
