In the event you have multiple versions of the Rails gem and want to generate an older version, you can do the following:
rails _2.0.2_ myapp
This will create a new myapp directory with Rails version 2.0.2.
Archive for the ‘Quick Tips’ Category
Generate Rails project for prior version
Posted in Quick Tips, RubyOnRails on July 14, 2008 | Comments Off
git checkout
Posted in Quick Tips, git on May 28, 2008 | Comments Off
This definitely falls in the duh! category:
If you delete a file and want to restore it to the trunk/master version, for subversion I would do:
svn update
to do the same with git:
git checkout <file>
Seems like this should have been obvious, but I guess I was expecting to find an update or restore or some other git [...]
Git and Tagging
Posted in Quick Tips, git on May 22, 2008 | Comments Off
Just a quick personal note on how to tag so I don’t have to look it up again. I’m not sure if this is right.?
git tag -a rel_0.0.0git push –tags
collect and flatten
Posted in Quick Tips, Ruby on February 12, 2008 | Comments Off
I run into this scenario many times and never really thought about changing it until recently. It’s very common, I have an array of values and I want to perform an action on each item. My return value would be an array of the results from the action.
Here’s a sample lookup that most [...]
rake db:migrate:redo
Posted in Quick Tips, RubyOnRails on December 18, 2007 | Comments Off
Nice new rake command to rollback one migration and migrate back up. If you need to go further than one step back pass the STEP=x parameter.
#Roll back 3 migrations and migrate back to current version.rake db:migrate:redo STEP=3
Custom Rake tasks
Posted in Quick Tips, RubyOnRails on December 17, 2007 | Comments Off
Writing your own custom Rake task is very simple and almost not worthy of a blog post, but I can’t remember everything, so it’s here for reference.
In your lib/tasks directory create a file with the extension .rake. i.e. print.rake.
namespace :print do
task :one do
attention “One”
end
task [...]
Komodo Edit – Indenting
Posted in Quick Tips on November 20, 2007 | Comments Off
To indent a bunch of lines at once just highlight them and hit the Tab key (Shift-Tab to undo indention).
Starting lighttpd
Posted in Quick Tips on November 20, 2007 | Comments Off
I didn’t want lighttpd starting on boot so I removed it:sudo launchctl unload -w /Library/LaunchDaemons/org.macports.lighttpd.plistBut then I couldn’t figure out how to start it. Bummer. Then I finally found:/opt/local/etc/LaunchDaemons/org.macports.lighttpd/lighttpd.wrapper start
gem server
Posted in Quick Tips, Ruby, RubyOnRails on November 20, 2007 | Comments Off
In the category of why I haven’t I used this yet (duh!):
run: gem_serverto run as daemon: gem_server –daemon
then access: localhost:8808
Documentation for your installed gems. Nice.
If you don’t have any documentation, run: gem rdoc –all
This will generate the docs for all the gems installed on your system.
Note: gem_server has been deprecated in favor of [...]
