Search code examples
mysqlruby-on-rails-4rails-migrations

Database field update, input doesn't change


Rails 4.1.1 Ruby 2.1.2

I have updated my production database with the following migration...

class UpdateLimitOnCustomerNameField < ActiveRecord::Migration
  def up
    def change
      change_column :customers, :name, :string, :limit => 30
    end
  end
  def down
    change_column :customers, :name, :string, :limit => 12
  end
end

My "db/schema.rb" file has updated...

create_table "customers", force: true do |t|
  t.string   "name",  limit: 30
  ...etc...
end

When I view my database in MySQL workbench I see the length of the field has updated to 30.

But when I visit the form on the website, I get this...

<input id="customer_name" maxlength="12" name="customer[name]" type="text">

How is the input field not updated to the new max length?

Thanks for any suggestions.


Solution

  • I hadn't worked on a rails site in over a year. I needed to update the assets also(even doh I only added a migration file).

    rake assets:precompile RAILS_ENV=production