<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Rida Al Barazi's Personal Blog &#187; Plugins</title>
	<atom:link href="http://rida.me/blog/category/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://rida.me/blog</link>
	<description>Rida's Zone in Cyberspace</description>
	<pubDate>Sat, 14 Feb 2009 14:49:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SimplySearchable plugin</title>
		<link>http://rida.me/blog/2008/11/05/simplysearchable-plugin/</link>
		<comments>http://rida.me/blog/2008/11/05/simplysearchable-plugin/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 22:27:11 +0000</pubDate>
		<dc:creator>Rida</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Plugins]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.ridaalbarazi.com/blog/2008/11/04/simplysearchable-plugin/</guid>
		<description><![CDATA[Update 1:Associations support has been implemented.
Almost a year ago I released SimplySearchable plugin to help me implement the filtering options of restate.ae and during this year I&#8217;ve been updating it regularly until it become something completely different so I did a quick rewrite, moved all the logic to the model, moved the repository to github [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 1:</strong>Associations support has been implemented.</p>
<p>Almost a year ago I released <strong>SimplySearchable</strong> plugin to help me implement the filtering options of <a href="http://restate.ae" title="restate.ae">restate.ae</a> and during this year I&#8217;ve been updating it regularly until it become something completely different so I did a quick rewrite, moved all the logic to the model, moved the repository to <a href="http://github.com">github</a> and here it is.</p>
<h3>SimplySearchable</h3>
<p>The main goal of <strong>SimplySearchable</strong> is to make it easy to do queries on your model by auto-magically creating some <em>named_scope</em> methods for common conditions.</p>
<p>This plugin adds a method to the model named <em>list</em> that will find and filter records smartly.</p>
<p>Please submit your bugs, requests and feedback at the project&#8217;s page on <a href="http://rbarazi.lighthouseapp.com/projects/19246/home">Lighthouse</a>. RDocs are available at <a href="http://ridaalbarazi.com/code/simply_searchable/">http://ridaalbarazi.com/code/simply_searchable/</a>.</p>
<h3>Installation</h3>
<pre>
  ./script/plugin install git://github.com/rbarazi/simply_searchable.git
</pre>
<p>And in your model:</p>
<pre>
  class Post < ActiveRecord::Base
    simply_searchable
  end
</pre>
<p>Then in your controller you can say:</p>
<pre>
  class PostsController < ApplicationController
    def index
    @posts = Post.list(params)
  end
</pre>
<h3>Example:</h3>
<p>If you have the following attributes in you posts table:</p>
<pre>
  Post
    id:integer
    title:string
    body:text
    category_id:integer
    created_at:datetime
    updated_at:datetime
</pre>
<p>And in your Model:</p>
<pre>
  class Post < ActiveRecord::Base
    has_many   :comments
    belongs_to :category
    simply_searchable
  end
</pre>
<p>This will create the following named scopes:</p>
<pre>
  named_scope where_id,         lambda {|value| { :conditions => ["id = ?", value] }}
  named_scope where_title,      lambda {|value| { :conditions => ["title like ?", "%#{value}%"] }}
  named_scope where_body,       lambda {|value| { :conditions => ["body like ?", "%#{value}%"] }}
  named_scope where_created_at, lambda {|value| { :conditions => ["created_at = ?", [*value]] }}
  named_scope where_updated_at, lambda {|value| { :conditions => ["updated_at = ?", [*value]] }}
  named_scope where_categories, lambda {|value| { :conditions => ["category_id in (?)", [*value]] }}
  named_scope where_comments,   lambda {|value| { :conditions => ["comments.ids in (?)", [*value]] }}
</pre>
<p>It will also create the method &#8216;list&#8217; which you can use like:</p>
<pre>
  Post.list(:title => 'abc', :created_at => Date.today)
</pre>
<p>Which will return the posts that contain &#8216;abc&#8217; in their title and created today.</p>
<p>By default SimplySearchable list will_paginate, you can still disable it:</p>
<pre>
  class Post < ActiveRecord::Base
    simply_searchable :will_paginate => false
  end
</pre>
<p>Or customize its settings:</p>
<pre>
  class Post < ActiveRecord::Base
    simply_searchable :per_page => 20
  end
</pre>
<p><del datetime="2008-11-10T11:07:14+00:00">In the new implementation there is no support for associations&#8217; filtering yet, it will come very soon though so stay tuned.</del> Association support has been implemented.</p>
]]></content:encoded>
			<wfw:commentRss>http://rida.me/blog/2008/11/05/simplysearchable-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ArabicHelper Plugin</title>
		<link>http://rida.me/blog/2008/10/12/arabic-helper-ruby-on-rails/</link>
		<comments>http://rida.me/blog/2008/10/12/arabic-helper-ruby-on-rails/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 14:57:01 +0000</pubDate>
		<dc:creator>Rida</dc:creator>
		
		<category><![CDATA[Plugins]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.ridaalbarazi.com/blog/?p=151</guid>
		<description><![CDATA[After working on several Ruby on Rails projects in Arabic lately I ended up repeating some functionality to support Arabic localization, specially on the Model and View levels so I decided to create a plugin for that, and I called it ArabicHelper.
I&#8217;ve been also following the updates in rails-I18n and did some work on the [...]]]></description>
			<content:encoded><![CDATA[<p>After working on several Ruby on Rails projects in Arabic lately I ended up repeating some functionality to support Arabic localization, specially on the Model and View levels so I decided to create a plugin for that, and I called it ArabicHelper.</p>
<p>I&#8217;ve been also following the updates in <a href="http://github.com/svenfuchs/rails-i18n/tree/master">rails-I18n</a> and did some work on the Arabic locale file, you can find it <a href="http://github.com/rbarazi/rails-i18n/tree/master">here</a>. You can simply use it if you are on Rails 2.2 or Rails Edge, or if you are not then use ArabicHelper.</p>
<h3>ArabicHelper</h3>
<p>A plugin to help you localize your Rails app to Arabic, this include few useful helpers and ActiveRecord localization</p>
<p>Arabic Helper consists of two parts, model extension and views helper methods. Model extension is to help you have Arabic error messages and attributes names in your model. Helper methods are made to support, pluralizing, country names and time distance in Arabic.</p>
<h4>Example</h4>
<p>Model extension:</p>
<pre>
  class Post
    has_arabic_attributes :body    => 'النص',
                          :user_id => 'الكاتب'
  end
</pre>
<p>View/Controller</p>
<pre>
  @post = Post.first
  @post.arabic_full_messages
</pre>
<p>Available helpers:</p>
<pre>
  arabic_country_options_for_select
  arabic_time_ago_in_words(from_time, include_seconds = false)
  arabic_distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
  arabic_pluralize(number, singular, double, plural, gender_class='male')
</pre>
<p>Install the plugin:</p>
<pre>
./script/plugin install git://github.com/rbarazi/arabic_helper.git
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rida.me/blog/2008/10/12/arabic-helper-ruby-on-rails/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

