ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

5
Date Submitted Thu. Feb. 8th, 2007 1:09 PM
Revision 1
Helper jeremec
Tags "ruby on rails" | fixtures | rails | Ruby
Comments 0 comments
I'm in the process of writing test fixtures for our rails site. A lot of my tests require authentication, so I've had to port our permissions system into a fixture. Rather than type out all of the information for the fixture, I decided to create a nested loop that will take care of this for me.

There's probably a rake task for this, but I wasn't able to find it, so I came up with my own solution. You'll have to do a little cleanup when it's done, however some slight mods to this loop could even eliminate that.
4
Date Submitted Thu. Oct. 19th, 2006 4:36 PM
Revision 1
Beginner lagsalot
Tags rails
Comments 0 comments
This will render a flash div only if there is a message in flash. Also will set the id to the flash key.

flash[:notice] returns

This is the notice
8
Date Submitted Wed. Oct. 11th, 2006 5:28 PM
Revision 1
Helper jeremec
Tags console | rails | reload | Ruby
Comments 1 comments
When doing a lot of testing in script/console, you often have to reload to pickup changes in DB schema, models and libs. The process of quitting the console and restarting it can become incredibly tedious amidst bugtracking.

note: I don't believe this reloads items in the libs dir
1
Date Submitted Wed. Oct. 11th, 2006 3:08 PM
Revision 1
Helper jeremec
Tags activerecord | find | override | rails | Ruby
Comments 0 comments
From time to time you may have reasons to override the default find method that ActiveRecord provides. In this example, we'll store a side-copy of the record attributes so that we have some basis for discovering changes to the data.

note: this will not override dynamic finders such as find_by_id
1
Date Submitted Fri. Jun. 16th, 2006 9:01 AM
Revision 1
Beginner cyu
Tags migration | rails | rake | Ruby
Comments 0 comments
By default, migrations will run on the development environment. Here's how you would specify another environment.