Archive for the ‘Rails Plugins’ Category

Plugin release: Root table

Yes, I’ve written another plugin for Rails. It’s about so called root tables. It seem to be making them often. I want a list with options to choose from and some easy way to manage that list, which is a tedious task. That’s why I made a plugin to do this for me.

What I have so far is:

  • Automatic validations and relations
  • Completely configurable, with sensible defaults
  • A management interface
  • Works with acts_as_list and supports drag and drop sorting
  • I18n support

Read more

  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • RSS
  • Twitter

no_value_helper plugin

It took some late night coding, but I finished another plugin. It’s a little helper that goes by the name of no_value_helper. To install it, type: ./script/plugin install git://github.com/iain/no_value_helper.git. It’s not that big, but fully tested, which may save you some time.

It changes:

< %= @user.name.blank? ? 'no value' : h(@user.name) %>

Into:

< %= show(@user.name, :h) %>

But wait! There is more! This method can accept blocks too and rescue you from those pesky nils! Keep on reading!

Read more

  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • RSS
  • Twitter

acts_as_translatable_model plugin

After a long day in the train today, I extracted the I18n functionality from ActiveRecord so its applicable to any class. This can be especially handy if the source of the data is different, e.g. LDAP. Just install the plugin and add one line to your class to make it translatable:

./script/plugin install git://github.com/iain/acts_as_translatable_model
class User
  acts_as_translatable_model

  attr_accessor :name, :password
end

Now you can do familiar things with the class, just as you would do with normal ActiveRecord models. Read more

  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • RSS
  • Twitter

Form Labels in Rails 2.2

Shamelessly copy-pasted from the README file of the new plugin I released today:

Since form labels don’t use I18n in Rails 2.2 (I was too late in submitting the patch), we’d have to make due with a plugin.

Installation and configuration consists of 1 easy steps:

  1. Run: ./script/plugin install git://github.com/iain/i18n_label.git

Example

In your translation file:

en-US:
  activerecord:
    attributes:
      topic:
        name: 'A nice name'

In your view:

<% form_for Topic.new do |f| %>
  <%= f.label :name %>
<% end %>

The result is:

<label for="topic_name">A nice name</label>

For more information about where to put your translations, read my post about translating ActiveRecord.

  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • RSS
  • Twitter

Plugin: translatable_columns

It was just three days ago when I discussed how to translate columns. At the moment I was writing it, I was already thinking: “this should be a plugin”. So today, I took the liberty and created it.

Contents

  1. Installing
  2. Usage
  3. Validating
  4. Customizing
  5. Some extras

Read more

  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • RSS
  • Twitter
Return top

About me

I am a Ruby programmer from Rotterdam, Netherlands. I started working with Ruby on Rails about 3 years ago and I've fallen in love with the language ever since.

When learning Ruby I noticed that the most useful information comes from blogs of other Ruby developers. I try to contribute to that.

I also am into writing plugins and gems. I hope you like my contributions and leave a comment if you do.