Roleify, a Rails authorization plugin
Today I’ve pushed a few updates to the Roleify rails plugin.
The changes are
- you can now use ‘namespaced’ controllers
- I added a helper method to hide/show blocks for a specified role
Example
The initializer
Roleify::Role.configure("role_a", "role_b") do
{
:role_a => { :dashboard_issues => :all },
:role_b => { :issues => "index" }
}
end
So, role_a refers to a Dashboard::IssuesController and role_b refers to an IssuesController.
The helper
module ApplicationHelper
include Roleify::RoleifyableHelper
end
The view
<% allowed?(Roleify::Role::ROLE_A) do %>
// whatever you want for role_a eyes only
<% end %>
More info on GitHub.
Rails `try`
try is one of those small new additions in the Rails 2.3 release. Luckily I found out about it via a Railscast
What is it?
Invokes the method identified by the symbol method, passing it any arguments and/or the block specified, just like the regular Ruby Object#send does. Unlike that method however, a NoMethodError exception will not be raised and nil will be returned instead, if the receiving object is a nil object or NilClass.
What did you just say?
The code above normally throws an exception if someobject is nil. By using try it just returns nil.
Don’t overuse this.
Using Java 6 with RubyMine on OS X
What do you need?
Next, open RubyMine’s Info.plist:
mate /Applications/RubyMine\ 1.0.5.app/Contents/Info.plist
Find the line with value 1.5* en change it to 1.6*.
Start RubyMine and check the ‘about’. It should look something like this:

Enjoy. It does feel snappier on my side.
On a sidenote: You can set the default Java version via the ‘Java Preferences’ app.
- Page 14 of 14
- Newest articles
- Newer articles
- Oldest articles
- Older articles



