Posted by mig
on May 07, 2008
Swapping out ERB for Erubis in a rails application is dead easy:
Install the gem:
gem i erubis
Require it:
# config/environment.rb
require 'erubis/helpers/rails_helper'
Preprocessing is awesome:
# config/environment.rb
require 'erubis/helpers/rails_helper'
Erubis::Helpers::RailsHelper.preprocessing = true
With that, you can use [%= %] inside your views instead of <%= %>. So doing this…
[%= link_to "New Post", new_article_path %]
…will process the link_to when the template is loaded. However, when it comes time to render, what is being rendered is something more like this:
<a href="/articles/new">New Post</a>
Which loads a lot faster than the ruby.
You can also preprocess enumerable statements, this is especially useful for something like this:
[% Category.find(:all).each do |c| %]
<li>[%= link_to c.name, category_path(c) %]</li>
[% end %]
Very intense.
Posted by mig
on April 28, 2008
Now that the Rails team has moved to using Lighthouse for bug, feature, and patch tracking, it’s a lot easier (and more fun) to track the patches coming in.
Just point your rss reader to: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/events.atom and watch the action! I know that ton’s of people followed development when they were using Trac, it just wasn’t as nice.
Posted by mig
on March 17, 2008
It’s a lot easier for me to hit ctrl-f than the right arrow key. Especially since I use my caps-lock as a ctrl key. These are Emacs navigation key combinations, and I can’t really work without them. TextMate has them built-in which is wonderful, Gedit on the other hand does not.
However, you can dig into your gconf settings and specify a “gtk key theme” other than the default one. You can specify emacs! Doing so, will allow you to use key combo’s like ctrl-f in Gedit and other Gtk applications.
Set the value of:
/desktop/gnome/interface/gtk_key_theme
To:
Emacs
Posted by mig
on March 03, 2008
I’ve put together a couple of Gedit plugins and snippets that will help your developing rails projects in Gnome.
Download gedit-rails at github.
This package includes a script that will register ERB templates and YAML files with gtksourceview. That means that you will get some nice syntax highlighting! Enjoy!
Posted by mig
on February 23, 2008
I like the default color scheme for syntax highlighting at Pastie, so I decided to make a TextMate theme using the same colors. It’s not perfect, but it’s close!
You can download it as part of my custom TextMate theme repository on github. If you don’t have git installed, just hit the download link on the github page.