Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
f3ndot opened this issue Apr 23, 2014 · 5 comments · May be fixed by #25
Open

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

f3ndot opened this issue Apr 23, 2014 · 5 comments · May be fixed by #25

Comments

@f3ndot
Copy link

f3ndot commented Apr 23, 2014

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
Copy link
Author

f3ndot commented Apr 23, 2014

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
Copy link
Contributor

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

Using Postgres & rails4. same issue really.

@asecondwill
Copy link
Contributor

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

@rlupiichuk
Copy link
Contributor

@f3ndot could you please create a PR for this?

@f3ndot
Copy link
Author

f3ndot commented May 21, 2014

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

@f3ndot f3ndot linked a pull request Jun 2, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants