<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gudasoft &#187; Rails</title>
	<atom:link href="http://www.gudasoft.com/category/english/development/rails-development/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gudasoft.com</link>
	<description>Impossible is nothing</description>
	<lastBuildDate>Mon, 26 Jul 2010 10:22:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Argh&#8230;this rmagick gem &#8211; aways difficult to install/maintain.</title>
		<link>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010</link>
		<comments>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010#comments</comments>
		<pubDate>Tue, 11 May 2010 14:12:28 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1241</guid>
		<description><![CDATA[I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error: RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError) google for This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError) then found this page in [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error:</p>
<p>RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)</p>
<p>google for <a href="http://www.google.com/search?hl=en&amp;q=t++This+installation+of+RMagick+was+configured+with+ImageMagick+6.5.5+but+ImageMagick+6.5.7-8+is+in+use.+%28RuntimeError%29&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=">This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)</a></p>
<p>then found <a href="http://uperro.blogspot.com/2010/05/after-upgrading-ubuntu-904-to-1004-lts.html">this page</a> in mixed English/Chinees</p>
<p>and finally got a <a href="http://adelio.org/redmine-lauft-nach-upgrade-auf-ubuntu-10-04-lucid-lynx-nicht-mehr/comment-page-1/">page</a> in German :)</p>
<p>Then I decide to write this post in English and slightly modify the solution</p>
<p>instead of putting</p>
<p>RMAGICK_BYPASS_VERSION_TEST = true in the deploy.rb</p>
<p>I have put this in the development.rb</p>
<p>and all it works &#8211; this way on the production I will be forced to use real compatible library or at least check again for another solution or gem.</p>
<p>AUCH! This solution doesn&#8217;t work even in development I got weird core dumps :( &#8230;so here it is another try</p>
<h1>Here is the real working  solution:</h1>
<pre>su -
git clone http://github.com/rmagick/rmagick.git
cd rmagick/
ruby setup.rb
ruby setup.rb  install</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nice code</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010#comments</comments>
		<pubDate>Tue, 20 Apr 2010 15:51:35 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1237</guid>
		<description><![CDATA[I have just finished one method and I was not happy with the code. Then I put a comment on top of the method &#8220;Far from perfect&#8230;.&#8221;. Then I read the class &#8211; it was ugly. here is the before def validate return if is_email == false found = InternetComunicatorType.find(:first, :conditions =&#62; { :is_email =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I have just finished one method and I was not happy with the code. Then I put a comment on top of the method &#8220;Far from perfect&#8230;.&#8221;.</p>
<p>Then I read the class &#8211; it was ugly.</p>
<p>here is the before</p>
<pre>def validate
 return if is_email == false
 found = InternetComunicatorType.find(:first, :conditions =&gt; {
 :is_email =&gt; true,
 })

 return unless found

 if found.id != id
 errors.add(:is_email, "We have already email type")
 return
 end
end
</pre>
<p>here is the after</p>
<pre>def validate
  if is_email
    found = InternetComunicatorType.find(:first, :conditions =&gt; {
      :is_email =&gt; true,
    })

    if found and found.id != id
      errors.add(:is_email, "We have already email type")
    end
  end
end</pre>
<p>The result is much far readable</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid presentations</title>
		<link>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010</link>
		<comments>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010#comments</comments>
		<pubDate>Thu, 15 Apr 2010 19:54:10 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[mongoid]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1235</guid>
		<description><![CDATA[When starting with mongoid I have missed a lot some demo source code. How it works with controllers, does it plays nice with nested attributes, such things. Here is presentation of mongo  and here are some slides]]></description>
			<content:encoded><![CDATA[<p>When starting with mongoid I have missed a lot some demo source code.</p>
<p>How it works with controllers, does it plays nice with nested attributes, such things.</p>
<p>Here is <a href="http://vimeo.com/9864311">presentation</a> of mongo  and here are <a href="http://www.slideshare.net/jsmestad/mongodb-mongoid-with-rails">some slides</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010#comments</comments>
		<pubDate>Thu, 01 Apr 2010 19:09:12 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1233</guid>
		<description><![CDATA[I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  &#8211; so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the [...]]]></description>
			<content:encoded><![CDATA[<p>I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  &#8211; so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the examples are not aways working and you have to fight with all the code &#8211; I don&#8217;t maybe I have found some old documentation. When you dive in the code &#8211; again no documentation and not clear behaviour. Maybe it is a good solution but for me it doesn&#8217;t work. I lost 1.5 days experimenting and hoping that the things will go.</p>
<p>Then I give a try with mongoid. It has wonderfull <a href="http://mongoid.org/docs/associations">documentation</a> for starters also it seems at first glance that the code in mongoid is more readably and human friendly. It took me 2hours to port all my models to mongoid.</p>
<p>The guy developing mongoid seems pretty active.</p>
<p>last words &#8211; it is pleasure to work with mongoid &#8211; I recommend it to all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting fast with rspec</title>
		<link>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009</link>
		<comments>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009#comments</comments>
		<pubDate>Sun, 29 Nov 2009 18:03:00 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1179</guid>
		<description><![CDATA[get the gem from here http://github.com/timcharper/spork &#160; How to fix the Missing error http://chrisblunt.com/blog/2009/08/28/rails-configuring-rspec-for-spork/ &#160;]]></description>
			<content:encoded><![CDATA[<p>get the gem from here</p>
<p>http://github.com/timcharper/spork</p>
<p>&nbsp;</p>
<p>How to fix the Missing error</p>
<p>http://chrisblunt.com/blog/2009/08/28/rails-configuring-rspec-for-spork/</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3.2+, memcached and logger</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009#comments</comments>
		<pubDate>Mon, 17 Aug 2009 11:43:42 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1058</guid>
		<description><![CDATA[Finally our twitterized version of psspy.se is ready. But! When in production &#8211; read with many connection &#8211; the memcached get overloaded by not closed connections and on 1024 it says &#8220;accept(): Too many open file&#8221; and memcached dies. After 1 day investigating the problem  we have found that the following line in the initializers [...]]]></description>
			<content:encoded><![CDATA[<p>Finally our twitterized version of psspy.se is ready. But! When in production &#8211; read with many connection &#8211; the memcached get overloaded by not closed connections and on 1024 it says</p>
<p>&#8220;accept(): Too many open file&#8221; and memcached dies.</p>
<p>After 1 day investigating the problem  we have found that the following line in the initializers is causing the problem</p>
<p>RAILS_DEFAULT_LOGGER.level = Logger::DEBUG</p>
<p>We havent investigating deeper but when commenting this line everything works fine.</p>
<p>We have tested with Rails 2.3.2 and 2.3.3 with memcache-client-1.7.4</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Ubuntu workstation configuration</title>
		<link>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009</link>
		<comments>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009#comments</comments>
		<pubDate>Wed, 24 Jun 2009 18:42:39 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[admini]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=989</guid>
		<description><![CDATA[XOrg configuration https://wiki.ubuntu.com/X/Config/Resolution cvt 1680 1050 75 xrandr &#8211;newmode &#8230;the output from cvt xrandr &#8211;newmode &#8220;1680x1050_75.00&#8243; 187.00 1680 1800 1976 2272 1050 1053 1059 1099 -hsync +vsync xrandr &#8211;addmode DVI-0 1680x1050_75.00 Lenovo Y510 You have to install the latest alsa. Then replace the existing kernel modules with the just build one. Then run depmod -a [...]]]></description>
			<content:encoded><![CDATA[<h1>XOrg configuration</h1>
<ul>
<li>https://wiki.ubuntu.com/X/Config/Resolution</li>
<li>cvt 1680 1050 75</li>
<li> xrandr &#8211;newmode &#8230;the output from cvt<br />
xrandr &#8211;newmode  &#8220;1680x1050_75.00&#8243;  187.00  1680 1800 1976 2272  1050 1053 1059 1099 -hsync +vsync</li>
<li> xrandr &#8211;addmode  DVI-0 1680x1050_75.00</li>
</ul>
<h1>Lenovo Y510</h1>
<p>You have to install the latest alsa.</p>
<p>Then replace the existing kernel modules with the just build one. Then run depmod -a as point kilbasar here</p>
<p>http://ubuntuforums.org/showthread.php?t=687663&amp;page=2</p>
<pre dir="ltr">sudo su
cd /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/
mv snd-hda-intel.ko snd-hda-intel.ko.bak
ln -s /lib/modules/2.6.22-14-generic/kernel/sound/pci/hda/snd-hda-intel.ko /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/snd-hda-intel.ko
cd /usr/src/alsa/alsa-driver-1.0.16rc2/modules
cp * /lib/modules/2.6.22-14-generic/kernel/sound/
depmod -a</pre>
<h1>Logitech Revolution MX</h1>
<p>http://x4.6times7.org/dokuwiki/doku.php/devlog/blog/howto_logitech_mx_revolution_on_ubuntu</p>
<ul>
<li>The mouse wheel control
<ul>
<li>Download from here http://goron.de/~froese/revoco/ or <a href="http://www.gudasoft.com/wp-content/uploads/2009/06/revoco-0.5.tar.gz">revoco-0.5.tar</a></li>
</ul>
<ul>
<li>make</li>
<li>sudo ./revoco manual=6</li>
<li><tt>lets try to add it in ~/.xprofile next time<br />
</tt></li>
</ul>
</li>
</ul>
<ul>
<li>Here is my xorg.conf</li>
</ul>
<pre>Section "Monitor"
 Identifier "External DVI"
 # 1680x1050 74.89 Hz (CVT 1.76MA) hsync: 82.31 kHz; pclk: 187.00 MHz
 Modeline "1680x1050_75.00"  187.00  1680 1800 1976 2272  1050 1053 1059 1099 -hsync +vsync
 # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
 Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
 # 1680x1050 69.88 Hz (CVT) hsync: 76.58 kHz; pclk: 174.00 MHz
 Modeline "1680x1050_70.00"  174.00  1680 1800 1976 2272  1050 1053 1059 1096 -hsync +vsync
 Option "PreferedMode"    "1280x1024_75.00"
EndSection

Section "Screen"
 Identifier    "Configured Screen Device"
 Device    "Configured Video Device"
 SubSection "Display"
 Depth    24
 Modes "1680x1050" "1024x768" "640x480"
 Virtual    2960 1050
 EndSubSection
EndSection

Section "Device"
 Identifier    "Configured Video Device"
 Option    "Monitor-DVI-0" "External DVI"
EndSection</pre>
<h1>My Development setup commands</h1>
<p>I noticed simillar post <a href="http://yobine.tistory.com/?page=3">here</a></p>
<pre>sudo aptitude install mc vim subversion screen pidgin meld curl links2 vim-ruby vim-gnome vim-doc vim-scripts vim-ruby vim-perl \
subversion git-core bluefish kompozer\
libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client \
libmysql-ruby1.8 irb ruby1.8 rdoc ri rake \
apt-utils build-essential ruby1.8-dev mysql-server memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop openssl \
libopenssl-ruby libmagick9-dev imagemagick librmagick-ruby1.8 imagemagick librmagick-ruby-doc  libmagick9-dev ruby1.8-dev \
libdbd-sqlite3-ruby libsqlite3-ruby sqlite3 libsqlite3-dev

ln -s /usr/bin/ruby1.8 /usr/bin/ruby

mkdir ruby_install
cd ruby_install
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xzvf ruby*
cd rubygems-1.3.5
ruby setup.rb
cd ..
cd ..

ln -s /usr/bin/gem1.8 /usr/bin/gem

gem install rails mysql mongrel mongrel_cluster rails paperclip will_paginate andand \
json feed-normalizer hpricot mechanize ruby-debug uuid ruport ruport-util acts_as_reportable \
rufus-scheduler annotate openwferu-scheduler production_log_analyzer capistrano-ext libxml-ruby twitter capistrano wirble RedCloth
rspec-rails sqlite3-ruby \
--no-ri --no-rdoc

gem install rmagick -v 1.15.12
ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"

cat &gt; /home/guda/.irbrc
require 'rubygems'
require 'wirble'
Wirble.init
Wirble.colorize
require 'logger'
if ENV.include?('RAILS_ENV') &amp;&amp; !Object.const_defined?('RAILS_DEFAULT_LOGGER')
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end

Gmail notification

http://www.workswithu.com/2009/10/06/gmail-notifier-applets-for-ubuntu/</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rake mysql tasks</title>
		<link>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009#comments</comments>
		<pubDate>Wed, 06 May 2009 19:06:13 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=880</guid>
		<description><![CDATA[I have found that I should be quicker if I put the following task in all my small projects. require &#8216;find&#8217; namespace :mysql do desc &#8220;Perform mysql dump on the RAILS_ENV environment&#8221; task :dump =&#62; :environment do db_config = ActiveRecord::Base.configurations[RAILS_ENV] backup_file = &#8220;#{db_config['database']}.sql&#8221; cmd = &#8220;mysqldump -u #{db_config['username']} -p#{db_config['password']} -Q &#8211;add-drop-table -O add-locks=FALSE -O lock-tables=FALSE [...]]]></description>
			<content:encoded><![CDATA[<p>I have found that I should be quicker if I put the following task in all my small projects.<br />
<span id="more-880"></span></p>
<p>require &#8216;find&#8217;<br />
namespace :mysql do<br />
desc &#8220;Perform mysql dump on the RAILS_ENV environment&#8221;<br />
task :dump =&gt; :environment do<br />
db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = &#8220;#{db_config['database']}.sql&#8221;<br />
cmd = &#8220;mysqldump -u #{db_config['username']} -p#{db_config['password']} -Q &#8211;add-drop-table -O add-locks=FALSE -O lock-tables=FALSE #{db_config['database']} -r #{backup_file}&#8221;<br />
puts cmd<br />
sh cmd<br />
end</p>
<p>desc &#8220;imports the dumped database in the mysql FILE&#8221;<br />
task :import =&gt; :environment do |t, args|<br />
version = ENV["FILE"] ? ENV["FILE"].to_i : nil<br />
raise &#8220;FILE is required&#8221; unless version</p>
<p>db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = ENV["FILE"]<br />
sh &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} -e \&#8221;CREATE DATABASE IF NOT EXISTS #{db_config['database']}\&#8221; &#8221;<br />
sh &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} #{db_config['database']} &lt; #{backup_file}&#8221;<br />
end</p>
<p>desc &#8220;runs the mysql console for the selected RAILS_ENV&#8221;<br />
task :console =&gt; :environment do<br />
db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = &#8220;#{db_config['database']}.sql&#8221;<br />
cmd = &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} #{db_config['database']}&#8221;<br />
sh cmd<br />
end</p>
<p>end</p>
<p>The task dumps just make a mysql dump from the current environment. Hmm. The next step is to transfer it with scp to my host.</p>
<p>Grab from <a href="http://errtheblog.com/posts/31-rake-around-the-rosie">here</a> the mysql console task</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql gem and the mkfm error</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009#comments</comments>
		<pubDate>Tue, 14 Apr 2009 15:44:32 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=789</guid>
		<description><![CDATA[The mysql gem was removed from the rails 2.3.2. and you need to install it via the gem install mysql command But! There is a problem compiling it. seems that the mysql cant find the libmysql so..here are the options: yum install openssl openssl-devel Configure with path to mysql_config and install the mysql api via [...]]]></description>
			<content:encoded><![CDATA[<pre>The mysql gem was removed from the rails 2.3.2. and you need to install it via the gem install mysql command
But! There is a problem compiling it. seems that the mysql cant find the libmysql so..here are the options:
yum install openssl openssl-devel

Configure with path to mysql_config and install the mysql api via gem:

# cd /usr/lib/ruby/gems/1.8/gems/mysql-2.7
# ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
# make
# ruby ./test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]
# make install
# gem install mysql

Source: http://www.linuxweblog.com/ruby-on-rails-install

And after that you can read the README.html located in the mysql gem directory :)</pre>
<h1>Debian/Ubuntu</h1>
<pre> sudo aptitude install libmysqlclient-dev libmysql-ruby  libmysql++-dev ruby-dev</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby classes and instances override</title>
		<link>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009</link>
		<comments>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009#comments</comments>
		<pubDate>Mon, 16 Feb 2009 13:43:25 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=526</guid>
		<description><![CDATA[module InstanceMethods def an_instance_method &#8220;You called an_instance_method on #{self.class}&#8221; end end module ClassMethods def a_class_method &#8220;You called a_class_method_from_module on #{self}&#8221; end def b_class_method puts &#8220;b_class_metbod&#8221; end end class MyClass include InstanceMethods extend ClassMethods def MyClass.a_class_method puts &#8220;Mine class Method&#8221; end def an_instance_method puts &#8220;Mine instance&#8221; end end my_class = MyClass.new puts my_class.an_instance_method puts MyClass.a_class_method puts [...]]]></description>
			<content:encoded><![CDATA[<p>module InstanceMethods<br />
def an_instance_method<br />
&#8220;You called an_instance_method on #{self.class}&#8221;<br />
end</p>
<p>end</p>
<p>module ClassMethods<br />
def a_class_method<br />
&#8220;You called a_class_method_from_module on #{self}&#8221;<br />
end</p>
<p>def b_class_method<br />
puts &#8220;b_class_metbod&#8221;<br />
end</p>
<p>end</p>
<p>class MyClass<br />
include InstanceMethods<br />
extend ClassMethods</p>
<p>def MyClass.a_class_method<br />
puts &#8220;Mine class Method&#8221;<br />
end</p>
<p>def an_instance_method<br />
puts &#8220;Mine instance&#8221;<br />
end<br />
end</p>
<p>my_class = MyClass.new<br />
puts my_class.an_instance_method<br />
puts MyClass.a_class_method<br />
puts MyClass.b_class_method</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>seesaw gem configuration</title>
		<link>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008#comments</comments>
		<pubDate>Mon, 10 Nov 2008 03:20:35 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=269</guid>
		<description><![CDATA[I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons. I will publish my configurations in case they are helpfull to some one. guda@guda-desktop:~/system3/config$ cat seesaw.yml --- restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid` config_symlink: http_cluster/cluster.conf mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml config_path: /home/mongrel/system3/current/config config_files: all: cluster_all.conf 1: [...]]]></description>
			<content:encoded><![CDATA[<p>I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons.</p>
<p>I will publish my configurations in case they are helpfull to some one.</p>
<p><code>
<pre>
guda@guda-desktop:~/system3/config$ cat seesaw.yml
---
restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
config_symlink: http_cluster/cluster.conf
mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml
config_path: /home/mongrel/system3/current/config
config_files:
  all: cluster_all.conf
  1: cluster_1.conf
  2: cluster_2.conf
symlink_cmd: ln -sf
</pre>
<p></code></p>
<p>here is where my nginx conf link points</p>
<p><code>
<pre>
guda@guda-desktop:~/system3/config/http_cluster$ ls -l
total 16
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_1.conf
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_2.conf
-rw-r--r-- 1 guda guda 277 2008-11-07 17:17 cluster_all.conf
lrwxrwxrwx 1 guda guda  66 2008-11-08 01:30 cluster.conf -> /home/mongrel/system3/current/config/http_cluster/cluster_all.conf
</pre>
<p></code></p>
<p>and in deploy.rb I have this task rewritten.</p>
<p><code>
<pre>
set :seesaw_conf, "#{current_path}/config/seesaw.yml"
namespace :deploy do
  desc <<-DESC
  Restart the Mongrel processes on the app server using seesaw
  DESC
  task :restart, :roles => :app do
    run <<-CMD
      cd #{current_path} ; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}
    CMD
#    send(run_method, "cd #{current_path}; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}")
  end
end
</pre>
<p></code></p>
<p>I am not sure that this is the perfect way of configurating the seesaw. I think that I have some mistakes in the path configurations, and because of that I have to patch the capistrano restart task.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing notes for Rails on Debian/Ubunto</title>
		<link>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008#comments</comments>
		<pubDate>Thu, 06 Nov 2008 20:17:13 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=246</guid>
		<description><![CDATA[Debian Etch with backports Add this line in sources.list to get rails &#62; 1.8.5 in rails etch deb http://www.backports.org/debian etch-backports main contrib non-free # deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free apt-get install debian-backports-keyring aptitude update # some ruby stuff aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8 # some system utils/libs aptitude install [...]]]></description>
			<content:encoded><![CDATA[<p>Debian Etch with backports</p>
<p>Add this line in sources.list to get rails &gt; 1.8.5 in rails etch</p>
<pre><code>deb http://www.backports.org/debian etch-backports main contrib non-free
# deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free
apt-get install debian-backports-keyring
aptitude update

# some ruby stuff
aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8

# some system utils/libs
aptitude install apt-utils build-essential mysql-server mysql-common mysql-client memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop  openssl

aptitude install -t etch-backports libopenssl-ruby

# gems
gem install rails mongrel mongrel_cluster -y
</code></pre>
<p>check this <a href="http://kete.net.nz/documentation/topics/show/116">step-by-step</a></p>
<p>Image magick linux howto &#8211; http://rmagick.rubyforge.org/install2-linux.html</p>
<pre><code>aptitude install libmagick9-dev  imagemagick librmagick-ruby1.8 imagemagick librmagick-ruby-doc  libmagick9-dev ruby1.8-dev</code></pre>
<pre><code>

# for version 1 of imagemagick we use this rmagick, else try it without the -v
gem install rmagick -v 1.15.12 

# lets test it
&gt; irb
require 'rubygems'
require 'RMagick'
Magick::CenterGravity
puts Magick::Long_version

# or with 

ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;" 

</code></pre>
<p>I love this tutorial on <a href="http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html">rubyinside</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chunks for the String method.</title>
		<link>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008</link>
		<comments>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008#comments</comments>
		<pubDate>Wed, 10 Sep 2008 08:59:47 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=125</guid>
		<description><![CDATA[If you want to generate some sort of chunks from a large strings you can use the following method. You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position. class String def String.random_alphanumeric(size=16) (1..size).collect { (i = Kernel.rand(62); i += [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to generate some sort of chunks from a large strings you can use the following method.<br />
You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position.</p>
<p><code><br />
class String</p>
<p>  def String.random_alphanumeric(size=16)<br />
    (1..size).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join<br />
  end</p>
<p>  def chunkanize(parts = [[0,4], [48, 52], [95, 100]])<br />
    return [self] if self.size <= 1</p>
<p>    # working with words<br />
    terms_array = self.split(/ /)<br />
    join_type = " "</p>
<p>    # working with letters<br />
    if terms_array.size <= 100<br />
      terms_array = self.split(//)<br />
      join_type = ""<br />
    end</p>
<p>    one_percent = terms_array.size.to_f / 100</p>
<p>    parts.collect do |part|<br />
      start = part[0]<br />
      stop = part[1]<br />
      terms_array[(start * one_percent)..(stop * one_percent)].join(join_type)<br />
    end<br />
  end</p>
<p>end<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails caching notes</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008#comments</comments>
		<pubDate>Tue, 26 Aug 2008 19:31:02 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=111</guid>
		<description><![CDATA[General Notes Very nice tutorial for rails 2.1 caching. API references: Fragments, Sweepers, the Store Post how to move the page cache in a folder with some server examples Observing Controllers with Sweepers Here is described how you can use the Sweepers to observe controller actions. I totaly agree that the documenation is very bad [...]]]></description>
			<content:encoded><![CDATA[<h2>General Notes</h2>
<p>Very nice <a href="http://www.ibm.com/developerworks/web/library/wa-rails1/">tutorial</a> for rails 2.1 caching.</p>
<p>API references: <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Fragments.html#M000641">Fragments,</a> <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Sweeping.html">Sweepers,</a> the <a href="http://api.rubyonrails.org/classes/ActiveSupport/Cache/MemoryStore.html">Store</a></p>
<p><a href="http://www.fngtps.com/2006/01/lazy-sweeping-the-rails-page-cache">Post</a> how to move the page cache in a folder with some server examples</p>
<h2>Observing Controllers with Sweepers</h2>
<p><a href="http://codelevy.com/articles/2008/03/04/rails-caching-sweepers-controllers-and-models">Here</a> is described how you can use the <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Sweeping.html">Sweepers</a> to observe controller actions. I totaly agree that the documenation is very bad on the sweepers and it is like a rule book of <a href="http://www.wizards.com/magic/">MTG</a> than usefull rdoc.</p>
<p>Here is what I have found on the naming of the callbacks.</p>
<p>Checking the source code in <a href="file:///var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sweeping.rb">sweeping.rb</a> shows that the callbacks that are used for the controller are constructed in this way:<br />
<code><br />
controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"<br />
action_callback_method_name     = "#{controller_callback_method_name}_#{controller.action_name}"</code></p>
<p>This means that the method which will be called in the sweeper will be named</p>
<ul>
<li>after/before_user &#8211; for the controller UserController</li>
<li>after/before_user_login &#8211; for the action login in the controller UserController</li>
</ul>
<p>Here is an example.</p>
<pre>class Dagens::UserController &lt; Dagens::BaseController
  cache_sweeper DagensAgentSweeper, :only =&gt; [:do_login, :do_delete_account, :do_logout]
  def do_login
  end
  ....
end

class DagensAgentSweeper &lt; ActionController::Caching::Sweeper
  observe DagensAgent

  def after_user_do_login
    puts "after do login \n \n \n \n \n \n \n "
    expire_cache_for(@logged_user)
  end
end</pre>
<h2>Skipping callbacks from an observer</h2>
<p>I know that it is not good idea, but some times there is no time/way to do skip it. I have found a plugin and this post <a href="http://integrumbles.com/2007/12/12/skipping-activerecord-callback-methods">here</a>. I have choose to use the second one in my project. Here is the example</p>
<pre>class DagensAgentSweeper &lt; ActionController::Caching::Sweeper
  observe DagensAgent

  def self.skip_callback(callback, &amp;block)
    method = instance_method(callback)
    remove_method(callback) if respond_to?(callback)
    define_method(callback) { true }
    result = yield
    remove_method(callback)
    define_method(callback, method)
    result
  end
........
end</pre>
<p>And later in the controller&#8230;.model&#8230;</p>
<pre>      DagensAgentSweeper.skip_callback(:after_update) do
        @agent.shown_times += 1
        @agent.save
      end
</pre>
<h2>timed_fragment_cache</h2>
<p>Some patches on the <a href="http://www.ruzee.com/blog/2008/07/timed_fragment_cache-on-rails-21/ ">timed_fragment_cache</a> plugin.</p>
<p>Note how  Jolyon Says suggest to expire the cache when you have time zone :  <code>when_fragment_expired ‘tags_home_page’, Time.now + 10.minutes do</code></p>
<p>I have notice that timed_fragment_cache (or the patch) have a problem with expiring the cache from the controller. In the documenation it is stated that it is ok to expire the cache only in the controller with</p>
<p><code>when_fragment_expired  "_last_update",  Time.now + 1.minutes  do</code></p>
<p>and there is no need to expire it in the view, but you MUST expire it in the view.</p>
<p><code>cache "_last_update" do</code></p>
<p>must be</p>
<p><code>cache "_last_update", Time.now + 1.minutes  do</code></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx with Rails</title>
		<link>http://www.gudasoft.com/english/linux/administration-linux/08/19/104/nginx-with-rails/2008</link>
		<comments>http://www.gudasoft.com/english/linux/administration-linux/08/19/104/nginx-with-rails/2008#comments</comments>
		<pubDate>Tue, 19 Aug 2008 15:37:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=104</guid>
		<description><![CDATA[downloaded from here documentation here If you want to try different solution check it haproxy compiled with: ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --user=mongrel make make install with fair balancing Fair load balancing for nginx from here ./configure --with-http_ssl_module --user=mongre --add-module=/usr/local/src/gnosek-nginx-upstream-fair --prefix=/usr/local/nginx --error-log-path=/var/log --http-log-path=/var/log make &#38;&#38; make install base configuration from here more and my favorite here is [...]]]></description>
			<content:encoded><![CDATA[<p>downloaded from <a href="http://sysoev.ru/nginx/download.html">here</a><br />
documentation <a href="http://sysoev.ru/nginx/docs/">here</a><br />
If you want to try different solution check it <a href="http://affectioncode.wordpress.com/2008/06/28/another-comparison-of-haproxy-and-nginx/">haproxy</a> <span id="more-104"></span> <code> compiled with:  ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --user=mongrel make make install </code></p>
<h2>with fair balancing</h2>
<p>Fair load balancing for nginx from <a href="http://wiki.codemongers.com/NginxHttpUpstreamFairModule">here </a></p>
<p><code></p>
<pre>./configure  --with-http_ssl_module --user=mongre --add-module=/usr/local/src/gnosek-nginx-upstream-fair --prefix=/usr/local/nginx --error-log-path=/var/log --http-log-path=/var/log 

make &amp;&amp; make install</pre>
<p></code></p>
<p>base configuration from <a href="http://blog.kovyrin.net/files/nginx-conf/rproxy.nginx.conf">here</a><br />
<a href="http://brainspl.at/articles/2006/08/23/nginx-my-new-favorite-front-end-for-mongrel-cluster">more</a> and my <a href="http://blog.jordanisip.com/2007/6/27/rimuhosting-vps-nginx-mongrel-clusters-multiple-domains-a-happy-jordan">favorite</a> here is good <a href="https://calomel.org/nginx.html">overview of example config </a><br />
init script from <a href="http://blog.labratz.net/articles/2006/10/03/rails-deployment-apache-lighttpd-nginx-mongrel-cluster">here</a></p>
<p>http://haproxy.1wt.eu/ is alternative for the nginx</p>
<p>I have one mongrel cluster which is serving multiple rails applications. In my example I host http://system3.spider.bg and http://www.psspy.se in one mongrel cluster.  here are the conf files:</p>
<pre># cat nginx.conf
user  mongrel mongrel;
worker_processes  2;

#error_log  logs/error.log;
error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    #worker_connections  16385;
    worker_connections  1024;
}

http {
    default_type  application/octet-stream;
    include       mime.types;

    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;
    server_tokens off;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay    on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
    gzip_proxied any;
#    gzip_http_version 1.1;
#    gzip_comp_level 1;
    gzip_types      text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    upstream truckhandboken_proxy {
        server 127.0.0.1:8000;
        server 127.0.0.1:8001;
    }

    upstream system3_proxy {
        server 127.0.0.1:8200;
        server 127.0.0.1:8201;
        server 127.0.0.1:8202;
        server 127.0.0.1:8203;
        server 127.0.0.1:8204;
        server 127.0.0.1:8205;
        server 127.0.0.1:8206;
        server 127.0.0.1:8207;
        server 127.0.0.1:8208;
        server 127.0.0.1:8209;
    }

    include     vhosts/*.conf;

    server {
        listen       80;
        server_name  localhost:80;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}</pre>
<p>The virtual host file</p>
<pre># cat system3.conf
    server {
        listen       80;
        #listen      192.168.1.1;
        #listen      192.168.1.1:8080;

        server_name  system3.spider.bg www.system3.spider.bg;

        access_log  logs/system3.access.log  main;

        location / {
            proxy_pass         http://system3_proxy;
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }
    }

server {
        listen       80;
        #listen      192.168.1.1;
        #listen      192.168.1.1:8080;

        server_name  *.psspy.se psspy.se;
        root    /home/mongrel/system3/current/public;
        access_log  logs/psspy_access.log  main;

        # Set the max size for file uploads to 50Mb
        client_max_body_size 50M;

        # this rewrites all the requests to the maintenance.html
        # page if it exists in the doc root. This is for capistrano's
        # disable web task
        if (-f $document_root/system/maintenance.html) {
            rewrite  ^(.*)$  /system/maintenance.html last;
            break;
        }

        location = / {
            if (-f /index.html){
             rewrite (.*) /index.html last;
            }
            proxy_pass  http://system3_proxy/dagensps;

            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }

        location / {
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;

            # If the file exists as a static file serve it directly without
            # running all the other rewite tests on it
            if (-f $request_filename) {
                break;
            }

            # check for index.html for directory index
            # if its there on the filesystem then rewite
            # the url to add /index.html to the end of it
            # and then break to send it to the next config rules.
            if (-f $request_filename/index.html) {
                rewrite (.*) $1/index.html break;
            }

            # this is the meat of the rails page caching config
            # it adds .html to the end of the url and then checks
            # the filesystem for that file. If it exists, then we
            # rewite the url to have explicit .html on the end
            # and then send it on its way to the next config rule.
            # if there is no file on the fs then it sets all the
            # necessary headers and proxies to our upstream mongrels
            if (-f $request_filename.html) {
               rewrite (.*) $1.html break;
            }

            if (!-f $request_filename) {
              proxy_pass         http://system3_proxy;
              break;
            }
        } # location

    error_page   500 502 503 504  /500.html;
    location = /500.html {
      root   /home/mongrel/system3/current/public/500.html;
    }

    error_page   404  /404.html;
    location = /404.html {
      root   /home/mongrel/system3/current/public/404.html;
    }

}# server

Good text: http://rubypond.com/articles/2008/02/01/setting-up-nginx-ssl-and-virtual-hosts/
There is generartor gem <a href="http://errtheblog.com/posts/52-nginx-config-like-whoa"><span class="code">nginx_config_generator</span></a>
example scripts: http://topfunky.net/svn/shovel/nginx/

nginx connects <a href="http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/">directly </a>to memcached for caching
for restarting nice you might want to see seesaw gem (presentation <a href="http://www.slideshare.net/addame/montreal-on-rails-5-rails-deployment-193082">here</a>) or this <a href="http://blog.carlmercier.com/2007/09/07/a-better-approach-to-restarting-a-mongrel-cluster/">blog</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/linux/administration-linux/08/19/104/nginx-with-rails/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you need to change a filename before sending it ?</title>
		<link>http://www.gudasoft.com/english/development/rails-development/07/17/91/do-you-need-to-change-a-filename-before-sending-it/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/07/17/91/do-you-need-to-change-a-filename-before-sending-it/2008#comments</comments>
		<pubDate>Thu, 17 Jul 2008 13:39:16 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=91</guid>
		<description><![CDATA[Rails action to send binary data I have one old application where the attachment is store as an id in the filesystem. The customer wants to have the attachment with the right name. So I have made this small action which accepts the id of the requested object and send the file data. def send_bios [...]]]></description>
			<content:encoded><![CDATA[<h1>Rails action to send binary data</h1>
<p>I have one old application where the attachment is store as an id in the filesystem. The customer wants to have the attachment with the right name. So I have made this small action which accepts the id of the requested object and send the file data.</p>
<pre><code>
  def send_bios
    redirect_to :action =&gt; 'bios' if params[:id].blank?
    @artist = Artist.find(params[:id]);
    contents = File.open(@artist.bios_path,"rb") {|io| io.read}
    send_data contents, :filename =&gt; "#{@artist.name}.pdf", :type =&gt; "application/pdf", :disposition =&gt; 'attachment'
  end
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/07/17/91/do-you-need-to-change-a-filename-before-sending-it/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random images helper for Rails</title>
		<link>http://www.gudasoft.com/english/development/rails-development/07/01/80/random-images-helper-for-rails/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/07/01/80/random-images-helper-for-rails/2008#comments</comments>
		<pubDate>Tue, 01 Jul 2008 14:11:48 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=80</guid>
		<description><![CDATA[Here is how to make random images generation for your website. First you must put your images in a folder /public/images/random_images or what ever. Second you put images there and mark the filenames with a prefix, which image to which section will be visible on. index_bottom_1.jpg -&#62; for the index page on the bottom :) [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how to make random images generation for your website.</p>
<p>First you must put your images in a folder /public/images/random_images or what ever.</p>
<p>Second you put images there and mark the filenames with a prefix, which image to which section will be visible on.</p>
<p>index_bottom_1.jpg -&gt; for the index page on the bottom :)</p>
<p>index_bottom_2.jpg -&gt; for the index page on the bottom</p>
<p>featured_art_1.jpg -&gt; some panel.</p>
<p>featured_art_2.jpg -&gt; some panel.</p>
<p>and so on&#8230;</p>
<p>Paste this method in your base controller. This method will be called to make list for a specific image folder and &#8220;filter&#8221; the images that are supposed to be showed in the different regions in @variables.</p>
<p><code> </code></p>
<pre>  before_filter :init_random_images
  protected # :) be carefull for this if you copy paste
  def init_random_images
    # collect some static images
    web_root = "images/imagestorage/random_images"

    all_images = Dir["#{RAILS_ROOT}/public/#{web_root}/*.jpg"]

    @random_head_images = []
    @random_indexbtm = []
    @random_featured = []
    @random_sales = []
    @random_services = []
    @random_framing = []
    @random_artistcollection = []
    all_images.each do |f|
      if File.stat(f).file?
        @random_head_images &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /head_images_/
        @random_indexbtm &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /indexbtm_/
        @random_featured &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /featured_/
        @random_sales &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /sales_/
        @random_services &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /services_/
        @random_framing &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /framing_/
        @random_artistcollection &lt;&lt; ("/#{web_root}/" + File.basename(f)) if f =~ /artistcollection_/
      end
    end</pre>
<p>Then paste this as a helper or in the base controller, to use it in your views. The method will give you from the <code>images</code> array, <code>count</code> number of images.</p>
<p><code> </code></p>
<pre>  helper_method :get_random_image
  def get_random_image(images, count)
    requested_images = []
    images_copy = images.clone
    [images_copy.size, count].min.times do
      index = rand(images_copy.size)
      requested_images &lt;&lt; images_copy[index]
      images_copy.delete_at(index)
    end
    requested_images.flatten.compact
  end</pre>
<p>here is an example how to use it.</p>
<pre><code>&lt;div id="static_logo" style="background:url(&lt;%= get_random_image(@random_sales, 1) %&gt;) no-repeat scroll left top;"&gt;
 </code></pre>
<h1>Future optimization</h1>
<p>Put some caching, not to make</p>
<pre><code>Dir["#{RAILS_ROOT}/public/#{web_root}/*.jpg"]
 </code></pre>
<p>on every request.</p>
<p>10x Bl8cki to the nice code optimizations :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/07/01/80/random-images-helper-for-rails/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Only get, head, post, put, and delete requests are allowed.</title>
		<link>http://www.gudasoft.com/english/development/rails-development/06/13/71/only-get-head-post-put-and-delete-requests-are-allowed/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/06/13/71/only-get-head-post-put-and-delete-requests-are-allowed/2008#comments</comments>
		<pubDate>Fri, 13 Jun 2008 09:35:59 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=71</guid>
		<description><![CDATA[I got this error when I have to upgrade one old project from rails 1.2.5 to rails 2.1 (the problem is not in rails) ActionController::MethodNotAllowed Only get, head, post, put, and delete requests are allowed. The exception: ActionController::MethodNotAllowed (Only get, head, post, put, and delete requests are allowed.): /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:384:in `recognize' I got this [...]]]></description>
			<content:encoded><![CDATA[<p>I got this error when I have to upgrade one old project from rails 1.2.5 to rails 2.1 (the problem is not in rails)</p>
<pre>ActionController::MethodNotAllowed

Only get, head, post, put, and delete requests are allowed.</pre>
<p>The exception:</p>
<pre>ActionController::MethodNotAllowed (Only get, head, post, put, and delete requests are allowed.):
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:384:in `recognize'</pre>
<p>I got this error only when I access URL&#8217;s with param like</p>
<p>http://127.0.0.1:3000/dod/images/show_big_image/1639</p>
<p>I found that the problem was in the :id because without the :id the method was called correctly</p>
<p>This means that there is something with the routes.</p>
<p>Not working routes.rb: &#8230;.<br />
<code> </code></p>
<pre>  map.connect '', :controller =&gt; 'auth'

  # Install the default route as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:sort_key/:sort_order'</pre>
<p>it will work if you swap the last two lines&#8230;.</p>
<p><code> </code></p>
<pre>  map.connect '', :controller =&gt; 'auth'

  # Install the default route as the lowest priority.
  map.connect ':controller/:action/:sort_key/:sort_order'
  map.connect ':controller/:action/:id'</pre>
<p>It seems that it does reading the comments in the routes.rb is usefull. There is written:<br />
<code> </code></p>
<pre><strong># Install the default route as the lowest priority.

</strong>This error also occurs if you haven't restart your webserver. I know that there is no need to restart it but its true, try restarting and check.</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/06/13/71/only-get-head-post-put-and-delete-requests-are-allowed/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails plugins, gems, search engines, applications</title>
		<link>http://www.gudasoft.com/uncategorized/05/26/28/rails-plugins/2008</link>
		<comments>http://www.gudasoft.com/uncategorized/05/26/28/rails-plugins/2008#comments</comments>
		<pubDate>Mon, 26 May 2008 06:18:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.gudasoft.com/?p=28</guid>
		<description><![CDATA[Plugins &#38; gems lists Associations http://www.workingwithrails.com/railsplugin/4801-has-many-polymorphs Versioning of AR http://github.com/fatjam/acts_as_revisable/tree/master http://opensoul.org/2006/7/21/acts_as_audited Scafolding http://streamlinedframework.org/pages/about Ajax pagination with JQuery http://ozmm.org/posts/ajax_will_paginate_jq_style.html Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values http://github.com/bumi/find_by_param/tree/master Asset Plugin &#8211; better than rails 2.0 integrated http://synthesis.sbecker.net/pages/asset_packager Image Magic http://vantulder.net/rails/magick/ OpenID http://wiki.rubyonrails.org/rails/pages/OpenidLoginGenerator http://github.com/technoweenie/restful-authentication/tree/master http://github.com/mrflip/ Model graph visualize [...]]]></description>
			<content:encoded><![CDATA[<h2>Plugins &amp; gems lists</h2>
<p>Associations</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://www.workingwithrails.com/railsplugin/4801-has-many-polymorphs</p>
<p>Versioning of AR</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://github.com/fatjam/acts_as_revisable/tree/master</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://opensoul.org/2006/7/21/acts_as_audited</p>
<p>Scafolding</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://streamlinedframework.org/pages/about</p>
<p>Ajax pagination with JQuery</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://ozmm.org/posts/ajax_will_paginate_jq_style.html</p>
<p>Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://github.com/bumi/find_by_param/tree/master</p>
<p>Asset Plugin &#8211; better than rails 2.0 integrated</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://synthesis.sbecker.net/pages/asset_packager</p>
<p>Image Magic</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://vantulder.net/rails/magick/</p>
<p>OpenID</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://wiki.rubyonrails.org/rails/pages/OpenidLoginGenerator</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://github.com/technoweenie/restful-authentication/tree/master</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://github.com/mrflip/</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">Model graph visualize</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px"><a href="http://www.franzens.org/?p=5">Article</a> on franzens.org</p>
<ul>
<li>http://visualizemodels.rubyforge.org/</li>
<li>http://rav.rubyforge.org/</li>
<li>http://railroad.rubyforge.org/</li>
</ul>
<h3>Simple Captcha</h3>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://expressica.com/simple_captcha/</p>
<h3>Memcached stuff</h3>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://townx.org/rails_and_memcached</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px"><a href="http://www.thewebfellas.com/blog/2008/6/9/rails-2-1-now-with-better-integrated-caching ">Good rails 2.1 overview</a></p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">memcached -vv -l 127.0.0.1 -p 11211 -m 256 -P /tmp/memcached.pid -u mongrel</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">memcached-tool 127.0.0.1</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">monitor the connections with the hidden option in the memcached-tool</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">echo $(($(netstat -nt | grep 11211 | grep -v WAIT | wc -l)/2)); ./memcached-tool 127.0.0.1:11211 dump &gt; memdump; cat memdump</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px"><a href="http://www.gudasoft.com/wp-content/uploads/2008/05/memcached-tool">memcached-tool</a></p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px"><a href="http://blog.evanweaver.com/articles/2008/01/21/b-the-fastest-u-can-b-memcached/">alternative memcached client</a></p>
<p>PDF Output</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://ruby-pdf.rubyforge.org/pdf-writer/</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://rubyforge.org/projects/railspdfplugin/</p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">Somone example <a href="http://pastie.org/39098">report</a></p>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">Need to be checked: http://code.rubyreports.org/</p>
<p style="text-align: left;">
<h2><span style="font-family: -webkit-monospace;">Reporting</span></h2>
<pre><code><a href="http://www.oreillynet.com/pub/a/ruby/2008/04/08/ruport-business-reporting-for-ruby.html?page=1">ruport &amp; acts_as_reportable</a>
some <a href="http://wiki.rubyonrails.org/rails/pages/howtointegratejasperreports">java reporting </a>into rails</code></pre>
<h2>Sending Email</h2>
<p style="text-align: left; padding-left: 30px;">Inline email attachments plugin: http://flow.handle.it/past/2007/11/5/inline_attachment_now_official_rocks/</p>
<h2>Wiki integration</h2>
<p>http://github.com/queso/signal-wiki/tree/master</p>
<h2>Repositories</h2>
<p>http://github.com/mrflip/</p>
<h2>Tutorials</h2>
<p>Rails2.0 Video http://www.vimeo.com/425800</p>
<p>http://media.rubyonrails.org/video/rails_take2_with_sound.mov</p>
<p>http://akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial</p>
<p>http://akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial-part-2</p>
<h2>Performance and Loging</h2>
<p>http://austinentrepreneur.wordpress.com/2008/06/21/announcing-clientperf-simple-client-side-rails-performance/</p>
<h3>web statistics</h3>
<p>http://www.railstat.com/wiki/FAQ</p>
<p>http://haveamint.com/about/feature_highlights &#8211; not free</p>
<h3>production log analyzers</h3>
<p>webstat like: http://watson.rubyforge.org/</p>
<p>speed: http://github.com/wvanbergen/request-log-analyzer/wikis</p>
<p>speed: http://ckhsponge.wordpress.com/2006/10/11/ruby-on-rails-log-analyzer-rawk/</p>
<p>pl-analyse: http://seattlerb.rubyforge.org/production_log_analyzer  http://seattlerb.rubyforge.org/production_log_analyzer</p>
<h2>Open source rails projects</h2>
<ul>
<li>Search engines
<ul>
<li>http://www.opensourcerails.com/</li>
<li>http://github.com/repositories</li>
</ul>
</li>
<li>E-Commerce solutions
<ul>
<li><a href="http://code.google.com/p/substruct/">http://code.google.com/p/substruct/</a></li>
<li>http://spreehq.org/demo</li>
<li><a href="http://www.google.bg/search?hl=bg&amp;rlz=1C1CHMB_bgBG323BG323&amp;q=rails+open+source+e-commerce&amp;btnG=Търсене&amp;meta=">search google</a></li>
</ul>
</li>
</ul>
<h2>Server setup</h2>
<h3>capistrano</h3>
<ul>
<li><a href="http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage">capistrano-multistage</a></li>
<li>gem install <a href="http://rubyforge.org/projects/rails-oceania/">seesaw</a> &#8211; restart app without loosing connections
<ul>
<li>mongrel_rails seesaw::configure &#8211;server nginx</li>
</ul>
</li>
</ul>
<h3>mod_rails</h3>
<ul>
<li style="http://www.gudasoft.com/wp-admin/padding-left: 30px">http://www.sysadminschronicles.com/articles/2008/05/13/ubuntu-8-04-rails-server-using-passenger-part-2</li>
</ul>
<h3>nginx</h3>
<ul>
<li>check my <a href="http://www.gudasoft.com/linux/administration-linux/08/19/104/nginx-with-rails/2008">post</a></li>
<li>gem install nginx_config_generator</li>
</ul>
<p style="http://www.gudasoft.com/wp-admin/padding-left: 30px">
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/uncategorized/05/26/28/rails-plugins/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" length="54364199" type="video/quicktime" />
		</item>
		<item>
		<title>will_paginate with ajax</title>
		<link>http://www.gudasoft.com/english/development/rails-development/05/16/38/will_paginate-with-ajax/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/05/16/38/will_paginate-with-ajax/2008#comments</comments>
		<pubDate>Fri, 16 May 2008 15:25:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.gudasoft.com/?p=38</guid>
		<description><![CDATA[It is very easy to handle ajax pagination as described on this post here. I want to give one full example. Here is how my form looks: &#60;% form_remote_tag :url =&#62; { :action =&#62; 'handle_urls', :script_id =&#62; @script, :page =&#62; params[:page], }, :html =&#62; {:id =&#62; 'f'}, :update =&#62; "filtered_articles_pane" do %&#62; Here is how [...]]]></description>
			<content:encoded><![CDATA[<p>It is very easy to handle ajax pagination as described on this post <a href="http://weblog.redlinesoftware.com/2008/1/30/willpaginate-and-remote-links">here.</a></p>
<p>I want to give one full example.</p>
<p>Here is how my form looks:<br />
<code> </code></p>
<pre>&lt;% form_remote_tag :url =&gt; {
                      :action =&gt; 'handle_urls',
                      :script_id =&gt; @script,
                      :page =&gt; params[:page],
                    },
  :html =&gt; {:id =&gt; 'f'},
  :update =&gt; "filtered_articles_pane" do %&gt;</pre>
<p>Here is how my will_paginate helper looks:<br />
<code> </code></p>
<pre>&lt;%= will_paginate @filtered_urls,
  :renderer =&gt; 'RemoteLinkRenderer',
  :remote =&gt; { :with =&gt; "'script_id=#{@script.id}&amp;approved_flag='+$(\'approved_flag\')",
  :update =&gt; 'filtered_articles_pane'} %&gt;</pre>
<p>I have used the improved version of the will_paginate:<br />
<code> </code></p>
<pre># Use it like so…
# will_paginate :collection, :remote =&gt; {:with =&gt; 'value', :update =&gt; 'some_div'} 

class RemoteLinkRenderer &lt; WillPaginate::LinkRenderer
  def initialize(collection, options, template)
    @remote = options.delete(:remote)
    super
  end

  def page_link_or_span(page, span_class = 'current', text = nil)
    text ||= page.to_s
    if page and page != current_page
      @template.link_to_remote(text, {:url =&gt; url_options(page), :method =&gt; :get}.merge(@remote))
    else
      @template.content_tag :span, text, :class =&gt; span_class
    end
  end
end
</pre>
<h1>Update for will_paginate 2.3.x</h1>
<pre><code class="ruby"><span class="comment"># app/helpers/remote_link_renderer.rb</span>

<span class="keywords">class</span> <span class="constants">RemoteLinkRenderer</span> &lt; <span class="constants">WillPaginate</span>:<span class="symbol">:LinkRenderer</span>
  <span class="keywords">def</span> prepare<span class="brackets">(</span>collection, options, template<span class="brackets">)</span>
    <span class="instance">@remote</span> = options<span class="method">.delete</span><span class="brackets">(</span><span class="symbol">:remote</span><span class="brackets">)</span> || <span class="brackets">{</span><span class="brackets">}</span>
    super
  <span class="keywords">end</span>

protected
  <span class="keywords">def</span> page_link<span class="brackets">(</span>page, text, attributes = <span class="brackets">{</span><span class="brackets">}</span><span class="brackets">)</span>
    <span class="instance">@template</span><span class="method">.link_to_remote</span><span class="brackets">(</span>text, <span class="brackets">{</span><span class="symbol">:url</span> =&gt; url_for<span class="brackets">(</span>page<span class="brackets">)</span>, <span class="symbol">:method</span> =&gt; <span class="symbol">:get</span><span class="brackets">}</span><span class="method">.merge</span><span class="brackets">(</span><span class="instance">@remote</span><span class="brackets">)</span><span class="brackets">)</span>
  <span class="keywords">end</span>
<span class="keywords">end</span></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/05/16/38/will_paginate-with-ajax/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
