Rails 4 migration: how to reorder columns

When using MySQL, you can call change_column, but you have to repeat the column type (just copy and paste it from your other migration): def up change_column :your_table, :some_column, :integer, after: :other_column end Or if you have to reorder multiple columns in one table: def up change_table :your_table do |t| t.change :some_column, :integer, after: :other_column … Read more

Forbidden Attributes Error in Rails 4 when encountering a situation where one would have used attr_accessible in earlier versions of Rails

Rails 4 now has features from the strong_parameters gem built in by default. One no longer has to make calls :as => :admin, nor do you need the attr_accessible :user_attribute, :as => admin in your model. The reason for this is that, by default, rails apps now have ‘security’ for every attribute on models. You … Read more

Rails 4.2: Internal Server Error with Maximum file multiparts in content reached

It looks like the multipart limit was added in the Rails 4.2 version of Rack (https://github.com/rack/rack/commit/b0b5fb9467e6ed777d3eaf35afc81d758e308aab). The default is 128, which may be too little for your purposes, it was for mine. Setting the value to 0 in an initializer removes the limit and fixes the problem: Rack::Utils.multipart_part_limit = 0 I would suggest tailoring the … Read more