diff options
| -rw-r--r-- | app/views/referentials/_reflines.html.slim | 4 | ||||
| -rw-r--r-- | db/migrate/20161208112130_create_routing_constraint_zones.rb | 20 |
2 files changed, 16 insertions, 8 deletions
diff --git a/app/views/referentials/_reflines.html.slim b/app/views/referentials/_reflines.html.slim index 730a45e0a..c0f0e03b7 100644 --- a/app/views/referentials/_reflines.html.slim +++ b/app/views/referentials/_reflines.html.slim @@ -1,7 +1,7 @@ -- if @reflines.any? +- if @reflines && @reflines.any? p strong Lignes : - + = table_builder @reflines, { 'Oid' => Proc.new { |n| n.objectid.local_id }, @reflines.human_attribute_name(:id) => 'id', @reflines.human_attribute_name(:number) => 'number', @reflines.human_attribute_name(:name) => 'name', @reflines.human_attribute_name(:network) => Proc.new { |n| n.try(:network).try(:name) }, @reflines.human_attribute_name(:company) => Proc.new { |n| n.try(:company).try(:name) } }, diff --git a/db/migrate/20161208112130_create_routing_constraint_zones.rb b/db/migrate/20161208112130_create_routing_constraint_zones.rb index 0fa1ef1ae..2c1ee8248 100644 --- a/db/migrate/20161208112130_create_routing_constraint_zones.rb +++ b/db/migrate/20161208112130_create_routing_constraint_zones.rb @@ -1,11 +1,19 @@ class CreateRoutingConstraintZones < ActiveRecord::Migration - def change - create_table :routing_constraint_zones do |t| - t.string :name - t.integer :stop_area_ids, array: true - t.belongs_to :line, index: true + def up + unless table_exists? :routing_constraint_zones + create_table :routing_constraint_zones do |t| + t.string :name + t.integer :stop_area_ids, array: true + t.belongs_to :line, index: true - t.timestamps + t.timestamps + end + end + end + + def down + if table_exists? :routing_constraint_zones + drop_table :routing_constraint_zones end end end |
