Wednesday, July 28, 2010

Solution: webrat's save_and_open_page and open_error_files are not opening the browser automatically

If you are using webrat's features like save_and_open_page or config.open_error_files and is not automatically opening your browser then you might need to install launchy, It fails silently, I know, it should be more informative:
sudo gem install launchy
More info about launchy: http://rubygems.org/gems/launchy/

Tuesday, July 20, 2010

Passing parameters to before_filter methods in Rails

If you have methods in your controller class that requires parameters you can still user them as filters.
Example:
def require_role(role)
#do some stuff with 'role' parameter
end
We can use it like this:
before_filter do |controller_instance|
controller_instance.require_role :admin
end
In fact, you can still use :only and :except if you need it, example:
before_filter :only => :index do |controller_instance|
controller_instance.require_role :admin
end
Have a nice day.

Monday, May 24, 2010

Installing Mono 2.6 (or the latests version) on Ubuntu 10.4(or the latest version)

This is a quick guide to install the latest mono runtime in your existing Ubuntu:
First of all:
  • I'm not an expert installing Mono from Sources, so this is all at your own risk.
  • Don't remove your existing Mono Runtine, you still need it.
  • I recommend you to keep your existing Mono Runtime(the one you installed via APT) side by side with the version that you are going to configure.
Here we go:
1.a using synaptic or aptitude, install the following packages:
  • autotools-dev
  • autoconf
  • libtool
  • bison
  • gettext
2. Download the Stable version right here:
http://ftp.novell.com/pub/mono/sources-stable/ (is the first one from the first group, currently the name is mono-2.6.4.tar.bz2)
3. Read the instructions right from the Mono wiki(but don't execute them yet):
Note: You may want to install into a different location and not '/usr/local' in order to avoid conflict with your existing Ubuntu Mono installation, so I would recommend you to use '$HOME/mono/local' or something, just like this:
./configure --prefix=$HOME/mono/local;
4. Now you can follow the instructions.
Feel free leave a comment if you find any errors.