diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index f7380f2dd..f7e202de5 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -608,6 +608,7 @@ class StepsController < ApplicationController ], tables_attributes: [ :id, + :name, :contents, :_destroy ] diff --git a/app/models/table.rb b/app/models/table.rb index 43dd90893..ca8397a56 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -1,6 +1,9 @@ class Table < ActiveRecord::Base include SearchableModel + auto_strip_attributes :name, nullify: false + validates :name, + length: { maximum: Constants::NAME_MAX_LENGTH } validates :contents, presence: true, length: { maximum: Constants::TABLE_JSON_MAX_SIZE_MB.megabytes } diff --git a/app/views/steps/_form_tables.html.erb b/app/views/steps/_form_tables.html.erb index f3e3bf6e6..642f51f30 100644 --- a/app/views/steps/_form_tables.html.erb +++ b/app/views/steps/_form_tables.html.erb @@ -8,8 +8,12 @@ <% end %> -