slate-studio / activeadmin-settings

Settings backend for activeadmin based projects - pretty handy tool.
88 stars 65 forks source link

Settings that are a length greater than 255 chars truncate in MySQL #22

Open f3ndot opened 10 years ago

f3ndot commented 10 years ago

Because t.string :string is used in the ActiveAdmin Settings migrations, long strings (or settings of type text) are truncated at 255 in MySQL.

The solution is to revise the migration to be the following:

# This migration comes from activeadmin_settings (originally 20121123145237)
class CreateActiveadminSettingsSettings < ActiveRecord::Migration
  def change
    create_table :activeadmin_settings_settings do |t|
      t.string :name
      t.text :string
      t.string :file

      t.timestamps
    end
  end
end

By using t.text it should allow any length, I believe.

f3ndot commented 10 years ago

I realize by doing this, all of the settings render <textarea>s now regardless of their type being set to string in the YAML file (and thusly <input> should be used).

If you adopt my strategy, you should have the form generator respect the type as defined in the YAML file.

asecondwill commented 10 years ago

+1 I'm getting: PG::StringDataRightTruncation - ERROR: value too long for type character varying(255)

Using Postgres & rails4. same issue really.

asecondwill commented 10 years ago

^ thats when using for example a redactor field and entering a bit of text & an image.

rlupiichuk commented 10 years ago

@f3ndot could you please create a PR for this?

f3ndot commented 10 years ago

@luckyjazzbo I'll get around to it when I have time. I'd want to solve the .yml problem with it as well.