From a03e8fa32de93f8096ea4cc42ddba267a95d7d39 Mon Sep 17 00:00:00 2001 From: Justin Bull Date: Sun, 1 Jun 2014 22:26:38 -0400 Subject: [PATCH 1/2] Make string db storage of type text; The string column stores a variety of things, from string to blobs of text to html. With its datatype being set to string, most databases impose a default limit of 255 characters. Text does not. --- .../20121123145237_create_activeadmin_settings_settings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20121123145237_create_activeadmin_settings_settings.rb b/db/migrate/20121123145237_create_activeadmin_settings_settings.rb index c2bcf04..8408368 100644 --- a/db/migrate/20121123145237_create_activeadmin_settings_settings.rb +++ b/db/migrate/20121123145237_create_activeadmin_settings_settings.rb @@ -2,7 +2,7 @@ class CreateActiveadminSettingsSettings < ActiveRecord::Migration def change create_table :activeadmin_settings_settings do |t| t.string :name - t.string :string + t.text :string t.string :file t.timestamps From 6abe1dbcb0d3f5a1255c0007e8f21240fc5cc9cd Mon Sep 17 00:00:00 2001 From: Justin Bull Date: Sun, 1 Jun 2014 22:46:26 -0400 Subject: [PATCH 2/2] Explicitly make string input render as a string input; Formtastic, left to its own devices, will implicitly assume an input for a column of type text to be, you guessed it, textarea. We force it to be string for the string (default) case. --- app/views/admin/settings/_settings_table.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/settings/_settings_table.html.erb b/app/views/admin/settings/_settings_table.html.erb index 4579a2c..f5e1a11 100644 --- a/app/views/admin/settings/_settings_table.html.erb +++ b/app/views/admin/settings/_settings_table.html.erb @@ -48,7 +48,7 @@ :as => :text, :input_html => { :class => "settings-redactor" } %> <% else %> - <%= f.input :string, :placeholder => "#{t '.default' }: " + setting.default_value(locale) %> + <%= f.input :string, :as => :string, :placeholder => "#{t '.default' }: " + setting.default_value(locale) %> <% end %> <% end %> <% end %>