diff options
| author | Alban Peignier | 2017-10-17 09:58:00 +0200 |
|---|---|---|
| committer | Alban Peignier | 2017-11-26 16:55:56 +0100 |
| commit | 61b03808e8e2314f0deb60f85d243aa15375aca6 (patch) | |
| tree | 73b7ae7cebfaa5c499c02140f29267eed0fd38b7 | |
| parent | a35fdf490b8803839d56e78029a936b541811665 (diff) | |
| download | chouette-core-61b03808e8e2314f0deb60f85d243aa15375aca6.tar.bz2 | |
Create STIF organisations with custom_view 'stif'. Refs #4735
| -rw-r--r-- | config/initializers/stif.rb | 6 | ||||
| -rw-r--r-- | db/migrate/20171001100642_stif_define_custom_view_for_organisations.rb | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb index f20429575..ad2ea6ed3 100644 --- a/config/initializers/stif.rb +++ b/config/initializers/stif.rb @@ -13,5 +13,11 @@ Rails.application.config.to_prepare do end unless Rails.env.test? Rails.application.config.to_prepare do + Organisation.before_validation(on: :create) do |organisation| + organisation.custom_view = "stif" + end +end + +Rails.application.config.to_prepare do Dashboard.default_class = Stif::Dashboard end diff --git a/db/migrate/20171001100642_stif_define_custom_view_for_organisations.rb b/db/migrate/20171001100642_stif_define_custom_view_for_organisations.rb new file mode 100644 index 000000000..304c90a1a --- /dev/null +++ b/db/migrate/20171001100642_stif_define_custom_view_for_organisations.rb @@ -0,0 +1,5 @@ +class StifDefineCustomViewForOrganisations < ActiveRecord::Migration + def change + Organisation.update_all custom_view: "stif" + end +end |
