Friday, 29 December 2006

Rails: Staying away from Enums in Migrations (ruby)

I was fiddling with migrations, and found these regarding the use of MySQL-ish ENUMs in Migrations:

Basically, ENUMs aren't supported, and using Validations might be a good work-around, but is dependent on you putting (and keeping) all of the logic in your Rails app. If you need to go cross-app (with some other thing that ain't rails), then use CHECK or other DB constraints to enforce desired values.

posted by erin at 02:48 PM (add comment)
Tuesday, 11 July 2006

Rails: Printing validation errors as flash notices (ruby)

I am quite sure someone has already found this simple solution, but when I poked around, I couldn't find it.

Here is my snippet to print out the error messages resulting from a validation as a flash notice:

  if @user.save 
    flash[:'notice'] = "New user saved successfully."  
  elsif !@user.errors.empty?
    flash[:'notice'] = "Could not save new user: " 
        << @user.errors.full_messages.join("; ")
  end
posted by erin at 06:43 PM
Sunday, 5 March 2006

Ruby and Rails. (ruby)

So. I'm fiddling. again. with Ruby on Rails. because it's trendy.

I have to say, it's also handy. Very nice not to have to write the entire DB framework just to make an app! The problem that I have is I'm such a habitual programming dork that I find Ruby's syntax a little odd...

posted by erin at 01:53 PM (add comment)
Friday, 24 June 2005

TXP Hack: centralizing priv lookups (textpattern)

I use HTTP Auth for one of my Textpattern installations, and so, I wanted people that could get to the textpattern pages to have, by default, staff writer permissions.

posted by erin at 10:45 AM (add comment)
Sunday, 6 March 2005

TXP Hack: preserving MT archive links... (textpattern)

There have been a few documented ways to migrate MT entries to textpattern. One of the issues has been preserving existing links to entries. Here is one way to do it.

posted by erin at 11:45 AM (add comment)

ARCHIVES

These are archived (old) articles, see:

About me

Ebullience
Myriad

About this site

The Archives
What is this blog stuff?
Why you should blog.

Sections
Categories: code

Etc.

[code]