fix snippets

Fix for "mysql error 1005 (errno: 150) "

Tagged mysql, sql, fix, problem, 150  Languages sql

There are at least three reasons, that I know of, to why you could be seeing mysql error 1005 (errno: 150)

  • Adding a foreign key constraint when column types don't match
  • Not enough privileges to execute the script
  • Trying to delete an index that is needed by some other index or constraint ("error on rename of")

Use "SHOW ENGINE INNODB STATUS;" to view the error:

ALTER TABLE videos ADD constraint fk_videos_channels_id FOREIGN KEY (channel_id) REFERENCES channels (id);

Fixing "undefined method white_list_sanitizer' for String:Class" and "undefined method full_sanitizer' for String:Class"

Tagged rails2.2, fix, ruby, sanitize  Languages ruby

If you get one of these errors, it's highly likely that you've upgraded to Rails 2.2 or higher:

undefined method white_list_sanitizer' for String:Class
undefined method full_sanitizer' for String:Class

The fix is to extend the SanitizeHelper.

class String
  extend ActionView::Helpers::SanitizeHelper::ClassMethods