<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUMFQXwyfCp7ImA9WhRRFE4.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195</id><updated>2011-11-27T15:43:30.294-08:00</updated><category term="watir select box" /><category term="ruby" /><category term="yield" /><category term="blocks" /><category term="rails defined" /><category term="order by field" /><category term="watir text field" /><category term="proc.call" /><category term="ruby keywords" /><category term="javascript object" /><category term="extend method" /><category term="defined?" /><category term="has_many relation" /><category term="has_many_friends" /><category term="html drop down" /><category term="active record base increment and decrement" /><category term="instance method" /><category term="acts_as_solr gem/plugin installtion" /><category term="ruby variable" /><category term="dropdown options" /><category term="functional testing in rails" /><category term="app.get" /><category term="find in windows" /><category term="Object in array" /><category term="instance method call using send" /><category term="dropdown selected" /><category term="hmbtm" /><category term="app.post" /><category term="post count plus month display" /><category term="$F" /><category term="jQuery conflict" /><category term="ruby module" /><category term="rails" /><category term="acts_as_solr on windows" /><category term="ruby send" /><category term="favicon" /><category term="model association" /><category term="rails has_many" /><category term="grep in windows" /><category term="friends association" /><category term="order by name" /><category term="active record increment field" /><category term="active record decrement field" /><category term="ruby defined" /><category term="prototype.js" /><category term="jquery with rails" /><category term="Proc" /><category term="rails prototype js" /><category term="js array" /><category term="script/console" /><category term="order by field option" /><category term="grep command" /><category term="acts_as_solr :if option" /><category term="Polymorphic relation" /><category term="console app" /><category term="array collect" /><category term="post count display" /><category term="order by month and year" /><category term="rails console" /><category term="method call" /><category term="$" /><category term="acts_as_solr options" /><category term="foreach method" /><category term="jquery" /><category term="js array for loop" /><category term="rails order  by" /><category term="acts_as_solr reindex with :if condition" /><category term="$W" /><category term="acts_as_solr" /><category term="multiple inheritance" /><category term="js array collect" /><category term="selected index value" /><category term="add fav icon" /><category term="sql order by" /><category term="assert_tag in rails" /><category term="acts_as_solr integration" /><category term="group by month" /><category term="$A" /><category term="ruby send method" /><category term="local variable" /><category term="update_attribute" /><category term="test text field select_tag div img in rails functionals testing" /><category term="json" /><title>vadivelan ruby on rails blog</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://vaddi-blog.blogspot.com/" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/VadivelanRubyOnRailsBlog" /><feedburner:info uri="vadivelanrubyonrailsblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DkAMSHw6eCp7ImA9WhdaEU0.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-8429622821822882528</id><published>2011-10-20T02:26:00.000-07:00</published><updated>2011-10-20T02:59:49.210-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-20T02:59:49.210-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr integration" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr reindex with :if condition" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr options" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr :if option" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr on windows" /><category scheme="http://www.blogger.com/atom/ns#" term="acts_as_solr gem/plugin installtion" /><title>Solr</title><content type="html">Integrating SOLR search into our application. “acts_as_solr” is the name of the plugin(also available as gem).&lt;br /&gt;Install plugin:&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;script&lt;span style='color:#808030; '&gt;/&lt;/span&gt;plugin install git:&lt;span style='color:#808030; '&gt;/&lt;/span&gt;&lt;span style='color:#808030; '&gt;/&lt;/span&gt;github&lt;span style='color:#808030; '&gt;.&lt;/span&gt;com&lt;span style='color:#808030; '&gt;/&lt;/span&gt;mattmatt&lt;span style='color:#808030; '&gt;/&lt;/span&gt;acts_as_solr&lt;span style='color:#808030; '&gt;.&lt;/span&gt;git&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Install gem:&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;gem install acts_as_solr&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Add the below line into your application's configuration file&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;config&lt;span style='color:#808030; '&gt;.&lt;/span&gt;gem &lt;span style='color:#0000e6; '&gt;"acts_as_solr"&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Add this at the end of your Rakefile(only for using gem)&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#400000; '&gt;require&lt;/span&gt; &lt;span style='color:#0000e6; '&gt;'aas_tasks'&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After installing gem/plugin, following rake tasks are available to use&lt;br /&gt;rake solr:destroy_index                              # Remove Solr index&lt;br /&gt;rake solr:reindex                                    # Reindexes data for all ac&lt;br /&gt;ts_as_solr models.&lt;br /&gt;rake solr:start                                      # Starts Solr.&lt;br /&gt;rake solr:stop                                       # Stops Solr.&lt;br /&gt;We can start, stop, reindex, destroy index by using the mentioned rake tasks.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Add the following rake task inside the solr rake file(gems/acts_as_solr/lib/tasks/solr.rake), to start solr in Windows environment.&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;desc &lt;span style='color:#0000e6; '&gt;"Starts Solr. on windows . Options accepted: RAILS_ENV=your_env, PORT=XX. Defaults to development if none."&lt;/span&gt;&lt;br /&gt;  task :start_win &lt;span style='color:#800000; font-weight:bold; '&gt;do&lt;/span&gt;&lt;br /&gt;    &lt;span style='color:#400000; '&gt;require&lt;/span&gt; &lt;span style='color:#0000e6; '&gt;"#{File.dirname(__FILE__)}/../../config/solr_environment.rb"&lt;/span&gt;&lt;br /&gt;    &lt;span style='color:#800000; font-weight:bold; '&gt;begin&lt;/span&gt;&lt;br /&gt;      n &lt;span style='color:#808030; '&gt;=&lt;/span&gt; Net::HTTP&lt;span style='color:#808030; '&gt;.&lt;/span&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;new&lt;/span&gt;&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;'localhost'&lt;/span&gt;, SOLR_PORT&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;br /&gt;      n&lt;span style='color:#808030; '&gt;.&lt;/span&gt;request_head&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;'/'&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#808030; '&gt;.&lt;/span&gt;value&lt;br /&gt;&lt;br /&gt;    &lt;span style='color:#800000; font-weight:bold; '&gt;rescue&lt;/span&gt; Net::HTTPServerException &lt;span style='color:#696969; '&gt;#responding&lt;/span&gt;&lt;br /&gt;      &lt;span style='color:#400000; '&gt;puts&lt;/span&gt; &lt;span style='color:#0000e6; '&gt;"Port #{SOLR_PORT} in use"&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;and&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;return&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style='color:#800000; font-weight:bold; '&gt;rescue&lt;/span&gt; Errno::ECONNREFUSED &lt;span style='color:#696969; '&gt;#not responding&lt;/span&gt;&lt;br /&gt;      Dir&lt;span style='color:#808030; '&gt;.&lt;/span&gt;chdir&lt;span style='color:#808030; '&gt;(&lt;/span&gt;SOLR_PATH&lt;span style='color:#808030; '&gt;)&lt;/span&gt; &lt;span style='color:#800000; font-weight:bold; '&gt;do&lt;/span&gt;&lt;br /&gt;        &lt;span style='color:#400000; '&gt;exec&lt;/span&gt; &lt;span style='color:#0000e6; '&gt;"java -Dsolr.data.dir=solr/data/#{ENV['RAILS_ENV']} -Djetty.port=#{SOLR_PORT} -jar start.jar"&lt;/span&gt;&lt;br /&gt;        &lt;span style='color:#400000; '&gt;sleep&lt;/span&gt;&lt;span style='color:#808030; '&gt;(&lt;/span&gt;&lt;span style='color:#008c00; '&gt;5&lt;/span&gt;&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style='color:#400000; '&gt;puts&lt;/span&gt; &lt;span style='color:#0000e6; '&gt;"#{ENV['RAILS_ENV']} Solr started sucessfuly on #{SOLR_PORT}, pid: #{pid}."&lt;/span&gt;&lt;br /&gt;      &lt;span style='color:#800000; font-weight:bold; '&gt;end&lt;/span&gt;&lt;br /&gt;    &lt;span style='color:#800000; font-weight:bold; '&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span style='color:#800000; font-weight:bold; '&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Steps to configure solr in our application&lt;br /&gt;&lt;br /&gt;1) Starts the solr server&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;rake solr:start&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) Changes to ActiveRecord model&lt;br /&gt;   acts_as_solr - all fields are indexed&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000; font-weight:bold; '&gt;class&lt;/span&gt; News &amp;lt; ActiveRecord::Base&lt;br /&gt;     acts_as_solr :fields &lt;span style='color:#808030; '&gt;=&lt;/span&gt;&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;:title, :content&lt;span style='color:#808030; '&gt;]&lt;/span&gt; &lt;br /&gt;   &lt;span style='color:#800000; font-weight:bold; '&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;   – specified fields are indexed&lt;br /&gt;We can specify the name of the fields to be used for searching.&lt;br /&gt;  Options:&lt;br /&gt;  :if =&gt; we can supply any condition as string, proc, symbol, method. It will index the record only if condition returns true.&lt;br /&gt;&lt;br /&gt;3) Do index/reindex&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;rake solr:reindex&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4) Changes to Controller&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;News&lt;span style='color:#808030; '&gt;.&lt;/span&gt;find_by_solr&lt;span style='color:#808030; '&gt;(&lt;/span&gt;query&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;query =&gt; query is a string representing your query&lt;br /&gt;  &lt;br /&gt;There are many options available in solr, we can do a refined search by using SOLR.&lt;br /&gt;&lt;br /&gt;Problem:&lt;br /&gt;I faced one problem, acts_as_solr :if option is not working with rake task to reindex data. Instead of checking the condition it will simply indexes all the records. But other method like solr_save() checks the condition passed with acts_as_solr definition in model. I have added a patch to check the condition in rake task 'reindex'.&lt;br /&gt;&lt;br /&gt;file path: acts_as_solr\lib\class_methods.rb&lt;br /&gt;line no: 200 - 250&lt;br /&gt;method name: rebuild_solr_index&lt;br /&gt;Instead of normal collect,&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;items&lt;span style='color:#808030; '&gt;.&lt;/span&gt;collect! &lt;span style='color:#800080; '&gt;{&lt;/span&gt; |content| content&lt;span style='color:#808030; '&gt;.&lt;/span&gt;to_solr_doc &lt;span style='color:#800080; '&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can use the following code, to filter the records with the condition defined in model and collect the remaining results&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;items &lt;span style='color:#808030; '&gt;=&lt;/span&gt; items&lt;span style='color:#808030; '&gt;.&lt;/span&gt;&lt;span style='color:#400000; '&gt;select&lt;/span&gt; &lt;span style='color:#800080; '&gt;{&lt;/span&gt; |content| content&lt;span style='color:#808030; '&gt;.&lt;/span&gt;evaluate_condition_public&lt;span style='color:#808030; '&gt;(&lt;/span&gt;content&lt;span style='color:#808030; '&gt;)&lt;/span&gt;&lt;span style='color:#800080; '&gt;}&lt;/span&gt;&lt;br /&gt;items&lt;span style='color:#808030; '&gt;.&lt;/span&gt;collect! &lt;span style='color:#800080; '&gt;{&lt;/span&gt; |content| content&lt;span style='color:#808030; '&gt;.&lt;/span&gt;to_solr_doc &lt;span style='color:#800080; '&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After doing the above changes, you can have a correct data in your search results. This is applicable only when we are using acts_as_solr with conditions in model.&lt;br /&gt;&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;acts_as_solr :fields &lt;span style='color:#808030; '&gt;=&lt;/span&gt;&gt; &lt;span style='color:#808030; '&gt;[&lt;/span&gt;&lt;span style='color:#0000e6; '&gt;"name"&lt;/span&gt;,&lt;span style='color:#0000e6; '&gt;"description"&lt;/span&gt;&lt;span style='color:#808030; '&gt;]&lt;/span&gt;, :&lt;span style='color:#800000; font-weight:bold; '&gt;if&lt;/span&gt; &lt;span style='color:#808030; '&gt;=&lt;/span&gt;&gt; &lt;span style='color:#400000; '&gt;proc&lt;/span&gt;&lt;span style='color:#800080; '&gt;{&lt;/span&gt;|record| record&lt;span style='color:#808030; '&gt;.&lt;/span&gt;active?&lt;span style='color:#800080; '&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Hope, this is useful for someone who is using acts_as_solr with :if option.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-8429622821822882528?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Wk91ANuUm8Mtan9WxAaLmPiFP6s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Wk91ANuUm8Mtan9WxAaLmPiFP6s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Wk91ANuUm8Mtan9WxAaLmPiFP6s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Wk91ANuUm8Mtan9WxAaLmPiFP6s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/kubpkj0_nvQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/8429622821822882528/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/10/solr.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8429622821822882528?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8429622821822882528?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/kubpkj0_nvQ/solr.html" title="Solr" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/10/solr.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8DQXszeCp7ImA9WhdQFks.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-3262536761748331695</id><published>2011-08-18T04:18:00.000-07:00</published><updated>2011-08-18T04:27:50.580-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-18T04:27:50.580-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="test text field select_tag div img in rails functionals testing" /><category scheme="http://www.blogger.com/atom/ns#" term="functional testing in rails" /><category scheme="http://www.blogger.com/atom/ns#" term="assert_tag in rails" /><title>Functional Testing in Rails(to test Html)</title><content type="html">Hi all,
&lt;br /&gt;
&lt;br /&gt;I have used listed out some uses of assert_tag in Rails functional test. In many case, we need to test the html content of page like checkbox is checked or not, text fields holds correct value, drop down selected with correct option. For those kind of needs, we need to go for &lt;span style="font-style:italic;"&gt;assert_tag&lt;/span&gt;. Below are the example usage of assert_tag in functional testing.
&lt;br /&gt;
&lt;br /&gt;In Rails html testing, assert_tag method plays an vital role. Following are some of the ways to use assert_tag method
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;Get links inside div
&lt;br /&gt;
&lt;br /&gt;assert_select "div#divID" do
&lt;br /&gt;		assert_select "a[href=?]", "/path/to/some/page"
&lt;br /&gt;end 
&lt;br /&gt;
&lt;br /&gt;Check the content of any html element(here is an example for Div)
&lt;br /&gt;		
&lt;br /&gt;		by className
&lt;br /&gt;		assert_select "div.className", "Page Heading or content inside the div"
&lt;br /&gt;		by element ID
&lt;br /&gt;		assert_select "div#elementId", "Page Heading or content inside the div"
&lt;br /&gt;
&lt;br /&gt;Check how many times any DOM element appears on the page:
&lt;br /&gt;
&lt;br /&gt;In the below example, we tested how many number of user images loaded on the page
&lt;br /&gt;assert_select "div.className table tr td.userImage img", {:count =&gt; 4}
&lt;br /&gt;
&lt;br /&gt;Presence of Textbox:
&lt;br /&gt;
&lt;br /&gt;assert_tag "input", :attributes =&gt; {:id =&gt; "user_screen_name", :size =&gt; "30", :type =&gt; "text"}
&lt;br /&gt;
&lt;br /&gt;Get value of Dropdown:
&lt;br /&gt;
&lt;br /&gt;option = css_select("select#elementId option[selected='selected']")[0]
&lt;br /&gt;assert_equal "public", option['value'].to_s
&lt;br /&gt;
&lt;br /&gt;Code with testcase improves the quality of code and at the sametime reduces the errors. Keep writing test for each line of code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-3262536761748331695?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qc0lq5lGRanHbMqWF9hTo5jgo4o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qc0lq5lGRanHbMqWF9hTo5jgo4o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qc0lq5lGRanHbMqWF9hTo5jgo4o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qc0lq5lGRanHbMqWF9hTo5jgo4o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/RRL7WPKfw_4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/3262536761748331695/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/08/functionals-testing-in-railsto-test.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3262536761748331695?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3262536761748331695?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/RRL7WPKfw_4/functionals-testing-in-railsto-test.html" title="Functional Testing in Rails(to test Html)" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/08/functionals-testing-in-railsto-test.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkABRHY6eCp7ImA9WhdaEU0.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-2569258973083582517</id><published>2011-04-18T06:41:00.000-07:00</published><updated>2011-10-20T02:59:15.810-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-20T02:59:15.810-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="find in windows" /><category scheme="http://www.blogger.com/atom/ns#" term="grep in windows" /><category scheme="http://www.blogger.com/atom/ns#" term="grep command" /><title>Alternative to "grep" command in Windows</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;I have shifted from ubuntu and started using windowsXP. When I tried to use the grep command in windows, it throws the error&lt;br /&gt;&lt;br /&gt;Instead of using grep, we can use find&lt;br /&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;gem list|find &lt;span style='color:#0000e6; '&gt;"rails"&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;rails (3.0.10)&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-2569258973083582517?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BOFcpAWTGxAS7_GN4hJnpgkV0x4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BOFcpAWTGxAS7_GN4hJnpgkV0x4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BOFcpAWTGxAS7_GN4hJnpgkV0x4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BOFcpAWTGxAS7_GN4hJnpgkV0x4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/AvYlNsoUue8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/2569258973083582517/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/04/alternative-to-grep-command-in-windows.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2569258973083582517?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2569258973083582517?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/AvYlNsoUue8/alternative-to-grep-command-in-windows.html" title="Alternative to &quot;grep&quot; command in Windows" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/04/alternative-to-grep-command-in-windows.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MGQH0yfip7ImA9Wx9VFk4.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-5470631268352243953</id><published>2011-02-02T01:27:00.000-08:00</published><updated>2011-02-02T01:37:01.396-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-02T01:37:01.396-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="group by month" /><category scheme="http://www.blogger.com/atom/ns#" term="post count display" /><category scheme="http://www.blogger.com/atom/ns#" term="order by month and year" /><category scheme="http://www.blogger.com/atom/ns#" term="post count plus month display" /><title>Month with number of count display for any model in your application</title><content type="html">By using rails finder method, it is very easy to display the number of post and month accordingly.&lt;br /&gt;Here is the query&lt;br /&gt;&lt;br /&gt;&gt;&gt; Post.count(:order =&gt; 'DATE(created_at) DESC', :group =&gt; ["DATE_FORMAT(created_at,'%m/%Y')"])&lt;br /&gt;=&gt; #&lt; OrderedHash {"06/2010"=&gt;1, "03/2010"=&gt;1, "02/2010"=&gt;1}&gt;&lt;br /&gt;&lt;br /&gt;Result is a collection hash ordered in the form of latest month as first one, Collection contains the month as Key and number of count as Value. &lt;br /&gt;&lt;br /&gt;If we run it through the each loop and it is very easy to display.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-5470631268352243953?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1xukLJV1oybJwaaJOGnx-ZK8kwY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1xukLJV1oybJwaaJOGnx-ZK8kwY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1xukLJV1oybJwaaJOGnx-ZK8kwY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1xukLJV1oybJwaaJOGnx-ZK8kwY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/unRyvXvb5BU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/5470631268352243953/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/02/month-with-number-of-count-display-for.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5470631268352243953?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5470631268352243953?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/unRyvXvb5BU/month-with-number-of-count-display-for.html" title="Month with number of count display for any model in your application" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/02/month-with-number-of-count-display-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QCQns6cSp7ImA9Wx9XFkk.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-7565451331535338959</id><published>2011-01-10T00:47:00.000-08:00</published><updated>2011-01-10T00:49:23.519-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-10T00:49:23.519-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby keywords" /><title>Ruby keywords</title><content type="html">List of ruby keywords&lt;br /&gt;&lt;br /&gt;1. alias&lt;br /&gt;2. and&lt;br /&gt;3. BEGIN&lt;br /&gt;4. begin&lt;br /&gt;5. break&lt;br /&gt;6. case&lt;br /&gt;7. class&lt;br /&gt;8. def&lt;br /&gt;9. defined&lt;br /&gt;10. do&lt;br /&gt;11. else&lt;br /&gt;12. elsif&lt;br /&gt;13. END&lt;br /&gt;14. end&lt;br /&gt;15. ensure&lt;br /&gt;16. false&lt;br /&gt;17. for&lt;br /&gt;18. if&lt;br /&gt;19. in&lt;br /&gt;20. module&lt;br /&gt;21. next&lt;br /&gt;22. nil&lt;br /&gt;23. not&lt;br /&gt;24. or&lt;br /&gt;25. redo&lt;br /&gt;26. rescue&lt;br /&gt;27. retry&lt;br /&gt;28. return&lt;br /&gt;29. self&lt;br /&gt;30. super&lt;br /&gt;31. then&lt;br /&gt;32. true&lt;br /&gt;33. undef&lt;br /&gt;34. unless&lt;br /&gt;35. until&lt;br /&gt;36. when&lt;br /&gt;37. while&lt;br /&gt;38. yield&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-7565451331535338959?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DpFZMytsdy4A4Z_YW-Q0ORtw5OY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DpFZMytsdy4A4Z_YW-Q0ORtw5OY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DpFZMytsdy4A4Z_YW-Q0ORtw5OY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DpFZMytsdy4A4Z_YW-Q0ORtw5OY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/E2MUqgnTHwA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/7565451331535338959/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/01/ruby-keywords.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7565451331535338959?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7565451331535338959?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/E2MUqgnTHwA/ruby-keywords.html" title="Ruby keywords" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/01/ruby-keywords.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UFRHc_eyp7ImA9Wx9XFkk.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-6532595902679533513</id><published>2011-01-09T23:32:00.000-08:00</published><updated>2011-01-10T00:46:55.943-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-10T00:46:55.943-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="order by field" /><category scheme="http://www.blogger.com/atom/ns#" term="sql order by" /><category scheme="http://www.blogger.com/atom/ns#" term="rails order  by" /><category scheme="http://www.blogger.com/atom/ns#" term="order by name" /><category scheme="http://www.blogger.com/atom/ns#" term="order by field option" /><title>SQL order_by "field" option</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;I tried to order the SQL results in a pre-defined order. Consider the case&lt;br /&gt;&lt;br /&gt;Am having users table, and a field called 'status' to store the current status of the user.&lt;br /&gt;In back-end of my site, am displaying all the users with order-by 'status'&lt;br /&gt;&lt;br /&gt;Possible status values are "Pending", "Approved", "Canceled", "Deleted"&lt;br /&gt;&lt;br /&gt;I need to display users in the following orders, &lt;br /&gt;"Approved", "Pending", "Canceled", "Deleted"&lt;br /&gt;&lt;br /&gt;The normal order by field orders the field in either ASC/DESC. But in this case it is different.&lt;br /&gt;For this i used the following query to fetch SQL results in a defined order&lt;br /&gt;&lt;br /&gt;Rails finder: &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;User.find_by_sql("select * from users order by field (status,'Approved', 'Pending', 'Canceled', 'Deleted')")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SQL query:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;select * from users order by field (status,'Approved', 'Pending', 'Canceled', 'Deleted');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Result contains the collection in the defined order.&lt;br /&gt;&lt;br /&gt;When you are using this "order by field" option, you have to give all the option in the order  then only it will works.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-6532595902679533513?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nusZpzIeWdOFuzv4sJFVngwoIjE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nusZpzIeWdOFuzv4sJFVngwoIjE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nusZpzIeWdOFuzv4sJFVngwoIjE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nusZpzIeWdOFuzv4sJFVngwoIjE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/HSzBxt98vuA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/6532595902679533513/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2011/01/sql-orderby-field-option.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6532595902679533513?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6532595902679533513?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/HSzBxt98vuA/sql-orderby-field-option.html" title="SQL order_by &quot;field&quot; option" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2011/01/sql-orderby-field-option.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUGQnkyfyp7ImA9Wx5aFEk.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-3625972589599748383</id><published>2010-11-10T19:28:00.000-08:00</published><updated>2010-11-10T19:30:23.797-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-10T19:30:23.797-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="update_attribute" /><category scheme="http://www.blogger.com/atom/ns#" term="active record base increment and decrement" /><category scheme="http://www.blogger.com/atom/ns#" term="active record increment field" /><category scheme="http://www.blogger.com/atom/ns#" term="active record decrement field" /><title>ActiveRecord::Base increment &amp; decrement method</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;Yesterday while i was working in a task, i need to increase the points of an user. For that i have used the update_attribute method like below&lt;br /&gt; &lt;br /&gt;user = User.last &lt;br /&gt;user.update_attribute(:points, 5)&lt;br /&gt;&lt;br /&gt;Then i found the active record base in-built method called "increment" and "decrement". So i used the following method to increment/decrement the user points. &lt;br /&gt;&lt;br /&gt;user.increment(:points) # it will increase points by 1(default increment count) and returns the user object(self)&lt;br /&gt;user.save&lt;br /&gt;user.increment!(:points) # and this one will do the above two operations i.e., assigns the value to the attribute and saves the record. It will returns true or false(validation result).&lt;br /&gt;&lt;br /&gt;user.increment(:points, 5) # we can pass the value like this to increment the attribute by this much. Here points will increases by 5&lt;br /&gt;user.save&lt;br /&gt;user.increment!(:points, 5)&lt;br /&gt;&lt;br /&gt;The same is applicable to the "decrement" method, syntax is given below&lt;br /&gt;user.decrement(:points)&lt;br /&gt;user.decrement!(:points)&lt;br /&gt;user.decrement(:points, 5)&lt;br /&gt;user.decrement!(:points, 5)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-3625972589599748383?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GvdDbHEZanY8qFtw8LgXQ755r1U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GvdDbHEZanY8qFtw8LgXQ755r1U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GvdDbHEZanY8qFtw8LgXQ755r1U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GvdDbHEZanY8qFtw8LgXQ755r1U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/3JP5Mi7QkGI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/3625972589599748383/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/11/activerecordbase-increment-decrement.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3625972589599748383?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3625972589599748383?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/3JP5Mi7QkGI/activerecordbase-increment-decrement.html" title="ActiveRecord::Base increment &amp; decrement method" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/11/activerecordbase-increment-decrement.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUERX8yeip7ImA9Wx5VFE8.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-2906716706784768504</id><published>2010-10-06T21:52:00.000-07:00</published><updated>2010-10-06T22:10:04.192-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-06T22:10:04.192-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="app.get" /><category scheme="http://www.blogger.com/atom/ns#" term="rails console" /><category scheme="http://www.blogger.com/atom/ns#" term="app.post" /><category scheme="http://www.blogger.com/atom/ns#" term="script/console" /><category scheme="http://www.blogger.com/atom/ns#" term="console app" /><title>Use of rails console</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;We can use our rails console(powerful tool for rails app) for debugging and testing. Mainly console helps us to learn more about Ruby&lt;br /&gt; &lt;br /&gt;Normally we are using console to talk with our database, and fetch the objects from db.&lt;br /&gt;ex: &lt;br /&gt;User.first&lt;br /&gt;User.all&lt;br /&gt;&lt;br /&gt;But apart from that we can use our console to interact with our application using the object "app"&lt;br /&gt;"app"&lt;br /&gt;&lt;br /&gt;app.class    # returns this&lt;br /&gt;ActionController::Integration::Session&lt;br /&gt;&lt;br /&gt;we can fire(get/post) requests to our application from console itself.&lt;br /&gt;&lt;br /&gt;&gt;&gt; app.get "/login"&lt;br /&gt;=&gt; 200&lt;br /&gt;it returns the status code for the handled request&lt;br /&gt; &lt;br /&gt;&gt;&gt; app.post "/user_sessions", :user_session =&gt; {:email =&gt; 'vadivelan@example.com', :password =&gt; 'secret'}&lt;br /&gt;=&gt; 302&lt;br /&gt;we can send post request with parameters like this&lt;br /&gt;&lt;br /&gt;&gt;&gt; app.response.redirect?&lt;br /&gt;=&gt; true&lt;br /&gt;redirected to some other url&lt;br /&gt;&lt;br /&gt;&gt;&gt; app.response.redirect_url&lt;br /&gt;=&gt; "http://localhost/login"&lt;br /&gt;view the redirect url &lt;br /&gt;&lt;br /&gt;Hope now you guys can start firing the requests to application from console.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-2906716706784768504?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7kCqYGTn7RUqZ5RGcJwYPlFN15M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7kCqYGTn7RUqZ5RGcJwYPlFN15M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7kCqYGTn7RUqZ5RGcJwYPlFN15M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7kCqYGTn7RUqZ5RGcJwYPlFN15M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/Fxa-blkDEb0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/2906716706784768504/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/10/use-of-rails-console.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2906716706784768504?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2906716706784768504?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/Fxa-blkDEb0/use-of-rails-console.html" title="Use of rails console" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/10/use-of-rails-console.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQMR388eip7ImA9Wx5WFUQ.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-8140232024966794906</id><published>2010-09-24T04:56:00.000-07:00</published><updated>2010-09-27T07:06:26.172-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-27T07:06:26.172-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby send" /><category scheme="http://www.blogger.com/atom/ns#" term="instance method call using send" /><category scheme="http://www.blogger.com/atom/ns#" term="ruby send method" /><category scheme="http://www.blogger.com/atom/ns#" term="method call" /><title>ruby send method</title><content type="html">Hi all&lt;br /&gt;&lt;br /&gt;I am started using the method named "send".&lt;br /&gt;&lt;br /&gt;We can use this to call the method using object.&lt;br /&gt;&lt;br /&gt;class User&lt;br /&gt;&lt;div style="text-align: left;"&gt; &lt;br /&gt;def say_hello&lt;br /&gt;"Hello"&lt;br /&gt;end &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;u = User.new&lt;br /&gt;puts u.send(:say_hello)&lt;br /&gt;&lt;br /&gt;Here the class "User" is having the method called say_hello. We can create an object for the user class and call the method using the method "send"&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-8140232024966794906?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GjcJrnlNi1vwQlK6ufxcooRV1b8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GjcJrnlNi1vwQlK6ufxcooRV1b8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GjcJrnlNi1vwQlK6ufxcooRV1b8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GjcJrnlNi1vwQlK6ufxcooRV1b8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/RBW6FuOOfLA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/8140232024966794906/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/09/ruby-send-method.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8140232024966794906?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8140232024966794906?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/RBW6FuOOfLA/ruby-send-method.html" title="ruby send method" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/09/ruby-send-method.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEFQXw-eCp7ImA9Wx5WEEQ.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-7432895291761350539</id><published>2010-09-21T11:14:00.000-07:00</published><updated>2010-09-21T11:26:50.250-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-21T11:26:50.250-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby module" /><category scheme="http://www.blogger.com/atom/ns#" term="multiple inheritance" /><category scheme="http://www.blogger.com/atom/ns#" term="extend method" /><category scheme="http://www.blogger.com/atom/ns#" term="instance method" /><title>ruby extend method</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;I have seen the method named "extend" used in a line of code in Plugin. Then i started searching for the use of method "extend". And i found the following&lt;br /&gt;&lt;br /&gt;consider the example&lt;br /&gt;&lt;br /&gt;module Friend&lt;br /&gt; def say_hello&lt;br /&gt;  "hello am inside module"&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class Person&lt;br /&gt; def say_hello&lt;br /&gt;  "hello am inside class"&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;p = Person.new&lt;br /&gt;puts p.say_hello  #=&gt; hello am inside class&lt;br /&gt;&lt;br /&gt;p.extend(Friend) #=&gt; include all the instance method from Module "Friend"&lt;br /&gt;puts p.say_hello #=&gt; hello am inside module&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So the extend method is used to include the Module.&lt;br /&gt;Without this we cannot call the method inside the module using the Person object. Even if i added include the module in the class, it wont calls the module method. The instance method inside the class gets called for the object(Person class).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-7432895291761350539?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kW0txNF5JahtqBhPEyLch03jWRw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kW0txNF5JahtqBhPEyLch03jWRw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kW0txNF5JahtqBhPEyLch03jWRw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kW0txNF5JahtqBhPEyLch03jWRw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/Bfxie9_hhhQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/7432895291761350539/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/09/ruby-extend-method.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7432895291761350539?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7432895291761350539?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/Bfxie9_hhhQ/ruby-extend-method.html" title="ruby extend method" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/09/ruby-extend-method.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4EQ3w7eCp7ImA9Wx5XFk8.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-2651199111333736016</id><published>2010-09-15T23:54:00.000-07:00</published><updated>2010-09-16T00:08:22.200-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-16T00:08:22.200-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blocks" /><category scheme="http://www.blogger.com/atom/ns#" term="proc.call" /><category scheme="http://www.blogger.com/atom/ns#" term="Proc" /><title>Use of Proc &amp; proc</title><content type="html">Hi &lt;br /&gt;&lt;br /&gt;I have used "proc" to run/block validation in model. But now i learned something more about proc. &lt;br /&gt;In ruby, "Proc"(procedure) refers to the block of code, we can reuse it. Block of code assigned to the object.&lt;br /&gt;&lt;br /&gt;"Proc" =&gt; Starts with capital letter refers to (class name)&lt;br /&gt;"proc" =&gt; Refers to the proc object&lt;br /&gt;&lt;br /&gt;We can use both the keywords to create a proc by defining any block to them.&lt;br /&gt;&lt;br /&gt;below sample code to create a proc and call that proc to execute the block of code&lt;br /&gt;&lt;br /&gt;accepts_any_arg = Proc.new{ |a,b,c|&lt;br /&gt; puts "#{a}  #{b}  #{c}"&lt;br /&gt;}&lt;br /&gt;accepts_any_arg.call(1)&lt;br /&gt; result: 1&lt;br /&gt;accepts_any_arg.call(1,2) &lt;br /&gt; result: 1  2&lt;br /&gt;It just neglects the number of arguments required or passing to that proc, it is working without any argument error. It assigns nil value to arguments which are not passed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;throws_args_error = proc{ |a,b,c|&lt;br /&gt; puts "#{a}  #{b}  #{c}"&lt;br /&gt;}&lt;br /&gt;throws_args_error.call(1,2,3)&lt;br /&gt;  result: 1  2  3&lt;br /&gt;throws_args_error.call(1)&lt;br /&gt;  result: Throws "ArgumentError"&lt;br /&gt;it is checking the number of arguments&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-2651199111333736016?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/avQuEkDiTFdJ7sbxrEle7RvsXiI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/avQuEkDiTFdJ7sbxrEle7RvsXiI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/avQuEkDiTFdJ7sbxrEle7RvsXiI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/avQuEkDiTFdJ7sbxrEle7RvsXiI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/zQ8DeYAANWU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/2651199111333736016/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/09/use-of-proc-proc.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2651199111333736016?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/2651199111333736016?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/zQ8DeYAANWU/use-of-proc-proc.html" title="Use of Proc &amp; proc" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/09/use-of-proc-proc.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04FRH48eSp7ImA9WxFaGEw.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-6802253290024953739</id><published>2010-07-22T08:10:00.001-07:00</published><updated>2010-07-22T08:18:35.071-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-22T08:18:35.071-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby defined" /><category scheme="http://www.blogger.com/atom/ns#" term="ruby variable" /><category scheme="http://www.blogger.com/atom/ns#" term="rails defined" /><category scheme="http://www.blogger.com/atom/ns#" term="local variable" /><category scheme="http://www.blogger.com/atom/ns#" term="defined?" /><title>Ruby - "defined?" method</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;In ruby we are having many methods to check whether the variable defined or not. Mostly we are using the following condition to check the variable defined or not&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;if local_variable&lt;br /&gt; puts "local variable exists"&lt;br /&gt;else&lt;br /&gt; puts "local_variable does not exists"&lt;br /&gt;end &lt;br /&gt;&lt;br /&gt;But there is another way to check the variable defined or not.&lt;br /&gt;&lt;br /&gt;sample-code:&lt;br /&gt;&lt;br /&gt;a = 10&lt;br /&gt;puts defined?(a).inspect =&gt; "local-variable"&lt;br /&gt;puts defined?(b).inspect =&gt; nil&lt;br /&gt;&lt;br /&gt;So, the method returns the value "local-variable" for the already defined variables and "nil" for the undefined variables.&lt;br /&gt;&lt;br /&gt;Hope hereafter you guys using the method "defined?" to check the variable already defined or not.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-6802253290024953739?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LdHYuvYFv0aNmZ2LQG_UWY-YxHI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LdHYuvYFv0aNmZ2LQG_UWY-YxHI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LdHYuvYFv0aNmZ2LQG_UWY-YxHI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LdHYuvYFv0aNmZ2LQG_UWY-YxHI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/mHYcSTn-PTs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/6802253290024953739/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/07/ruby-defined-method.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6802253290024953739?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6802253290024953739?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/mHYcSTn-PTs/ruby-defined-method.html" title="Ruby - &quot;defined?&quot; method" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/07/ruby-defined-method.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQHQXk-eCp7ImA9WxFXF0s.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-7489976998390618118</id><published>2010-05-24T20:54:00.000-07:00</published><updated>2010-05-24T21:05:30.750-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-24T21:05:30.750-07:00</app:edited><title>ruby math functions</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;Here i have listed some of the most frequently used math functions in ruby.&lt;br /&gt;&lt;br /&gt;round method rounds the value &lt;br /&gt;if decimal value is less than .5, rounded to its lowest value&lt;br /&gt;irb(main):006:0&gt; 1.2.round&lt;br /&gt;=&gt; 1&lt;br /&gt;if decimal value is greater than .4, rounded to its highest value&lt;br /&gt;irb(main):007:0&gt; 1.5.round&lt;br /&gt;=&gt; 2&lt;br /&gt;&lt;br /&gt;floor method rounded the value to lowest value&lt;br /&gt;irb(main):008:0&gt; 1.5.floor&lt;br /&gt;=&gt; 1&lt;br /&gt;&lt;br /&gt;ceil method rounded the value to next highest value&lt;br /&gt;irb(main):009:0&gt; 1.5.ceil&lt;br /&gt;=&gt; 2&lt;br /&gt;&lt;br /&gt;'nan' method used to check whether the value is integer or not&lt;br /&gt;irb(main):010:0&gt; x = 0.0/0.0&lt;br /&gt;=&gt; NaN&lt;br /&gt;&lt;br /&gt;irb(main):011:0&gt; x.nan?&lt;br /&gt;=&gt; true&lt;br /&gt;&lt;br /&gt;Get ASCII value&lt;br /&gt;irb(main):017:0&gt; Integer(?e)&lt;br /&gt;=&gt; 101&lt;br /&gt;&lt;br /&gt;irb(main):018:0&gt; Float(?e)&lt;br /&gt;=&gt; 101.0&lt;br /&gt;&lt;br /&gt;&gt;&gt; "%.2f" % (1.0/2.0)&lt;br /&gt;=&gt; "0.50"&lt;br /&gt;&lt;br /&gt;The last method is mainly used for display purpose. We have to display the floating point number in any page(say to display the cost) we must modify the output in such a way to get clear display(Max of 2 numbers after decimal point in this case).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-7489976998390618118?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nUUbWtOeiXKjONaJFRLtThqGNo8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nUUbWtOeiXKjONaJFRLtThqGNo8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nUUbWtOeiXKjONaJFRLtThqGNo8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nUUbWtOeiXKjONaJFRLtThqGNo8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/H5WPgUax3u4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/7489976998390618118/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/05/ruby-math-functions.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7489976998390618118?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/7489976998390618118?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/H5WPgUax3u4/ruby-math-functions.html" title="ruby math functions" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/05/ruby-math-functions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EGQHo5fip7ImA9WxFXF0g.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-4458195590873519495</id><published>2010-05-24T20:45:00.000-07:00</published><updated>2010-05-24T20:53:41.426-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-24T20:53:41.426-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="prototype.js" /><category scheme="http://www.blogger.com/atom/ns#" term="rails prototype js" /><category scheme="http://www.blogger.com/atom/ns#" term="$A" /><category scheme="http://www.blogger.com/atom/ns#" term="$" /><category scheme="http://www.blogger.com/atom/ns#" term="$W" /><category scheme="http://www.blogger.com/atom/ns#" term="$F" /><title>Some more uses of '$' in prototype javascript</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;We are all using the '$' in prototype javascript to get the object of the matched DOM element by using id of the element.&lt;br /&gt;&lt;br /&gt;Say for example:&lt;br /&gt;&lt;br /&gt;the page has the div element &lt;br /&gt;&lt;div id='container'&gt;&lt;br /&gt;   content inside the div element &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To get the object of the div element we are using the '$'.&lt;br /&gt;&lt;br /&gt;$('container') =&gt; returns the object of the DOM element.&lt;br /&gt;&lt;br /&gt;$A/$W/$F =&gt; are also available but rarely used..&lt;br /&gt;&lt;br /&gt;the below lines explain the use of the $A/$W/$F&lt;br /&gt;&lt;br /&gt;// converts a string into array, each element is taken as a count&lt;br /&gt;&gt;&gt;&gt; $A('1')&lt;br /&gt;['1']&lt;br /&gt;&gt;&gt;&gt; $A('123')&lt;br /&gt;["1", "2", "3"]&lt;br /&gt;&lt;br /&gt;// converts a string into array, it takes whitespace as delimiters&lt;br /&gt;&gt;&gt;&gt; $w('1 2 3')&lt;br /&gt;["1", "2", "3"]&lt;br /&gt;&lt;br /&gt;// used to get values of text field which is located inside any forms&lt;br /&gt;// same as Form.Element.getValue&lt;br /&gt;&gt;&gt;&gt; $F('press_room_url')&lt;br /&gt;&lt;br /&gt;So start using these commands makes the code simpler.. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vadivelan&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-4458195590873519495?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BH_RH4gD7HkGT_G6Mn5NpjXLWDE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BH_RH4gD7HkGT_G6Mn5NpjXLWDE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BH_RH4gD7HkGT_G6Mn5NpjXLWDE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BH_RH4gD7HkGT_G6Mn5NpjXLWDE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/-d3UIoLp_Mc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/4458195590873519495/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/05/some-more-uses-of-in-prototype.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4458195590873519495?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4458195590873519495?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/-d3UIoLp_Mc/some-more-uses-of-in-prototype.html" title="Some more uses of '$' in prototype javascript" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/05/some-more-uses-of-in-prototype.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8HRXc4fSp7ImA9WxFTEEQ.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-1087927664716773792</id><published>2010-03-31T21:48:00.000-07:00</published><updated>2010-03-31T21:57:14.935-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-31T21:57:14.935-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jquery" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery with rails" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery conflict" /><title>jQuery with rails</title><content type="html">Hi all,&lt;br /&gt;&lt;br /&gt;I have used the jquery js prototype recently, it has lots of more usage than our prototype.js. Easy to code using jQuery.js.&lt;br /&gt;&lt;br /&gt;But in my rails application i have used both prototype.js &amp; jquery.js. In this situation the $ gets conflict. To avoid conflict, use the line of code&lt;br /&gt;&lt;br /&gt;First include prototype.js, then add jQuery.js after that you must add this line to avoid ($)conflict&lt;br /&gt;&lt;script&gt;&lt;br /&gt;var $j = jQuery.noConflict();&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Once you done this, you can enjoy the usage of both prototype.js &amp; jQuery.js.&lt;br /&gt;&lt;br /&gt;i.e., both $ and $j is available to access.&lt;br /&gt;&lt;br /&gt;$('id_of_dom_elemnt') =&gt; returns (prototype)object of the html element&lt;br /&gt;$j('#id_of_dom_element') =&gt; return (jquery)object of the html element&lt;br /&gt;&lt;br /&gt;In jQuery, we have to add '#' symbol with id of dom element to find the element.&lt;br /&gt;&lt;br /&gt;Enjoy coding with jQuery... &lt;br /&gt;&lt;br /&gt;thanks,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-1087927664716773792?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/k7nUU63dds19IhIZFMHGXQ5Ey5c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/k7nUU63dds19IhIZFMHGXQ5Ey5c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/k7nUU63dds19IhIZFMHGXQ5Ey5c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/k7nUU63dds19IhIZFMHGXQ5Ey5c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/gfa58FAbhaQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/1087927664716773792/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/03/jquery-with-rails.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/1087927664716773792?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/1087927664716773792?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/gfa58FAbhaQ/jquery-with-rails.html" title="jQuery with rails" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/03/jquery-with-rails.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EGRXcyeip7ImA9WxBXEkk.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-4923037709322684898</id><published>2010-01-23T02:04:00.000-08:00</published><updated>2010-01-23T02:13:44.992-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T02:13:44.992-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Object in array" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript object" /><category scheme="http://www.blogger.com/atom/ns#" term="js array" /><category scheme="http://www.blogger.com/atom/ns#" term="json" /><title>JSON startup</title><content type="html">JSON - javascript object notation&lt;br /&gt;&lt;br /&gt;To know about the JSON, first go through the following basics in js.&lt;br /&gt;&lt;br /&gt;Array:&lt;br /&gt;&lt;br /&gt;var arr = new Array("first", "second", "third", "fourth");&lt;br /&gt;&lt;br /&gt;Retrieve value from array&lt;br /&gt;&lt;br /&gt;arr[0]  =&gt; "first"&lt;br /&gt;arr[1]  =&gt; "second"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Object:&lt;br /&gt;&lt;br /&gt;var sample_object = {&lt;br /&gt; "name1" : "value1",&lt;br /&gt; "name2" : "value2",&lt;br /&gt; "name3" : "value3",&lt;br /&gt; "name4" : "value4"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sample_object.name1  =&gt; "value1"&lt;br /&gt;sample_object["name1"]  =&gt; "value1"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Objects in Array&lt;br /&gt;&lt;br /&gt;var object_array = [&lt;br /&gt; {&lt;br /&gt;  "first_element" : "first_value"&lt;br /&gt; },&lt;br /&gt; {&lt;br /&gt;  "second_element" : "second_value"&lt;br /&gt; }&lt;br /&gt;]&lt;br /&gt;object_array[0]  =&gt; returns first object &lt;br /&gt;object_array[1].second_element  =&gt; second object value&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Arrays in Object:&lt;br /&gt;&lt;br /&gt;var sample_object = {&lt;br /&gt; "name1" : "value1",&lt;br /&gt; "name4" : [1,2,3,4]&lt;br /&gt;}&lt;br /&gt;sample_object.name4  =&gt; [1,2,3,4]&lt;br /&gt;sample_object.name4[0]  =&gt; 1&lt;br /&gt;&lt;br /&gt;var str_json = JSON.stringify(sample_object);&lt;br /&gt;var js_object = JSON.parse(str_json);&lt;br /&gt;JSON.parse(strJSON) - converts a JSON string into a JavaScript object.&lt;br /&gt;JSON.stringify(objJSON) - converts a JavaScript object into a JSON string.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-4923037709322684898?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6snTfKFyYiF3LzFuFWgKu451kU0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6snTfKFyYiF3LzFuFWgKu451kU0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6snTfKFyYiF3LzFuFWgKu451kU0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6snTfKFyYiF3LzFuFWgKu451kU0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/Xq08P7yLO3k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/4923037709322684898/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2010/01/json-startup.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4923037709322684898?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4923037709322684898?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/Xq08P7yLO3k/json-startup.html" title="JSON startup" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2010/01/json-startup.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYBRnsyeyp7ImA9WxBTEkk.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-4670038696127529851</id><published>2009-12-07T18:33:00.000-08:00</published><updated>2009-12-07T18:42:37.593-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-07T18:42:37.593-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="watir text field" /><category scheme="http://www.blogger.com/atom/ns#" term="watir select box" /><title>Watir tips</title><content type="html">Hi Guys,&lt;br /&gt;&lt;br /&gt;Waitr is a ruby gem used in testing. It has many uses, mostly it is used to control the web browser(all html dom elements as objects).&lt;br /&gt;&lt;br /&gt;installation command:-&lt;br /&gt;gem install waitr&lt;br /&gt;&lt;br /&gt;Some sample use of watir&lt;br /&gt;&lt;br /&gt;1. Starting a new Web browser&lt;br /&gt;require 'watir'&lt;br /&gt;ie = Watir::Browser.new&lt;br /&gt;ie.goto("http://www.google.com")&lt;br /&gt;&lt;br /&gt;2. Starting a firefox browser&lt;br /&gt;require 'watir'&lt;br /&gt;Watir::Browser.default = "firefox"&lt;br /&gt;ff = Watir::Browser.start("http://www.google.com")&lt;br /&gt;&lt;br /&gt;3.Setting a text field with some value&lt;br /&gt;&lt;br /&gt;ie.text_field(:name, "username").set "Vaddi"&lt;br /&gt;&lt;br /&gt;4. Setting value of select list&lt;br /&gt;&lt;br /&gt;ie.select_list( :name , "category").select("Comedy")&lt;br /&gt;&lt;br /&gt;For all the DOM elements, it has objects(for text box - 'text_field', for drop down - 'select_list')&lt;br /&gt;&lt;br /&gt;thanks,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-4670038696127529851?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3tMeLa69afyqJiBLbIslSmPVsTs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3tMeLa69afyqJiBLbIslSmPVsTs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3tMeLa69afyqJiBLbIslSmPVsTs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3tMeLa69afyqJiBLbIslSmPVsTs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/D7f8wiycO7U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/4670038696127529851/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/12/watir-tips.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4670038696127529851?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4670038696127529851?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/D7f8wiycO7U/watir-tips.html" title="Watir tips" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/12/watir-tips.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08NQXs9fSp7ImA9WxNaGUQ.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-5253603130591391784</id><published>2009-12-04T18:46:00.000-08:00</published><updated>2009-12-04T21:44:50.565-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-04T21:44:50.565-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="js array for loop" /><category scheme="http://www.blogger.com/atom/ns#" term="foreach method" /><category scheme="http://www.blogger.com/atom/ns#" term="js array collect" /><title>for loop - js</title><content type="html">In javascript, to read the array index and their appropriate value.&lt;br /&gt;&lt;br /&gt;Use the following way,&lt;br /&gt;&lt;br /&gt;var a = Array.new(); declare new array with name 'a'&lt;br /&gt;a = [1,2,3,4,5];  assign some values to array&lt;br /&gt;var indexes = function show(value, indx){&lt;br /&gt;    alert(indx);&lt;br /&gt;    alert(value);&lt;br /&gt;}&lt;br /&gt;a.forEach(indexes);&lt;br /&gt;'forEach' method is used to collect the values from the array.&lt;br /&gt;&lt;br /&gt;By using the method 'forEach', we can collect each element from array.&lt;br /&gt;&lt;br /&gt;Try this..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-5253603130591391784?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tOId16KJUuuliNp6oaxBvTCT8Kg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tOId16KJUuuliNp6oaxBvTCT8Kg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tOId16KJUuuliNp6oaxBvTCT8Kg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tOId16KJUuuliNp6oaxBvTCT8Kg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/NN0n8Egf-cE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/5253603130591391784/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/12/for-loop-js.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5253603130591391784?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5253603130591391784?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/NN0n8Egf-cE/for-loop-js.html" title="for loop - js" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/12/for-loop-js.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUBQH86cSp7ImA9WxNaFUo.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-3238777931371679412</id><published>2009-11-30T01:06:00.000-08:00</published><updated>2009-11-30T01:10:51.119-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-30T01:10:51.119-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="favicon" /><category scheme="http://www.blogger.com/atom/ns#" term="add fav icon" /><title>Add favicon image to your site</title><content type="html">Its very easy to add favicon to ur site by following steps&lt;br /&gt;&lt;br /&gt;include the line in your layout head&lt;br /&gt;html link tag &lt;br /&gt;with attributes &lt;br /&gt;rel="icon" href="favicon_path" &lt;br /&gt;type="image/x-icon"&lt;br /&gt;&lt;br /&gt;favicon_path = image path of favicon&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;Try with this..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-3238777931371679412?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DT4t-DJ1jVAF-j2feI-rHlfXrlA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DT4t-DJ1jVAF-j2feI-rHlfXrlA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DT4t-DJ1jVAF-j2feI-rHlfXrlA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DT4t-DJ1jVAF-j2feI-rHlfXrlA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/V5ye88IAyKc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/3238777931371679412/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/11/add-favicon-image-to-your-site.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3238777931371679412?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/3238777931371679412?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/V5ye88IAyKc/add-favicon-image-to-your-site.html" title="Add favicon image to your site" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/11/add-favicon-image-to-your-site.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIHR3o7eCp7ImA9WxNaE08.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-6599478807373370209</id><published>2009-11-27T03:54:00.000-08:00</published><updated>2009-11-27T04:05:36.400-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-27T04:05:36.400-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rails has_many" /><category scheme="http://www.blogger.com/atom/ns#" term="friends association" /><category scheme="http://www.blogger.com/atom/ns#" term="has_many_friends" /><category scheme="http://www.blogger.com/atom/ns#" term="hmbtm" /><title>has_many_friends association</title><content type="html">Hi Guys,&lt;br /&gt;&lt;br /&gt;I have stuck while building the association for model user, &lt;br /&gt;user has_many friends, friend - nothing but a user&lt;br /&gt;&lt;br /&gt;For that i have created a model called 'Friendship', user to join user and friends. And build the association with the following relations&lt;br /&gt;&lt;br /&gt;friendship table has the following fields&lt;br /&gt;user_id&lt;br /&gt;friend_id&lt;br /&gt;&lt;br /&gt;class User &lt; ActiveRecord::Base&lt;br /&gt;has_many :friendships  &lt;br /&gt;has_many :friendships_by_me, :foreign_key =&gt; 'user_id', :class_name =&gt; 'Friendship'&lt;br /&gt;has_many :friends_by_me, :through =&gt; :friendships_by_me, :source =&gt; :friendshipped_by_me&lt;br /&gt;has_many :friendships_for_me, :foreign_key =&gt; 'friend_id', :class_name =&gt; 'Friendship'&lt;br /&gt;has_many :friends_for_me, :through =&gt; :friendships_for_me, :source =&gt; :friendshipped_for_me &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class Friendship &lt; ActiveRecord::Base&lt;br /&gt; belongs_to :user &lt;br /&gt; belongs_to :friendshipped_for_me, :class_name =&gt; "User", :foreign_key =&gt; 'user_id'&lt;br /&gt; belongs_to :friendshipped_by_me, :class_name =&gt; "User", :foreign_key =&gt; 'friend_id'&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;Thats it!!!&lt;br /&gt;&lt;br /&gt;Now run the following commands&lt;br /&gt;&lt;br /&gt;user = User.first&lt;br /&gt;user.friends_by_me  =&gt; [users] returns the collection of friends added by user.&lt;br /&gt;user.friends_for_me  =&gt; [users] returns the collection of friends who add user as their friend.&lt;br /&gt;&lt;br /&gt;Note: i have referred the plugin 'has_many_friends'.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;vaddi&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-6599478807373370209?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_jZDDSuEAGSP--lH6fz1megukv0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_jZDDSuEAGSP--lH6fz1megukv0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_jZDDSuEAGSP--lH6fz1megukv0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_jZDDSuEAGSP--lH6fz1megukv0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/zVUvtAqy4Dg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/6599478807373370209/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/11/hasmanyfriends-association.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6599478807373370209?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/6599478807373370209?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/zVUvtAqy4Dg/hasmanyfriends-association.html" title="has_many_friends association" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/11/hasmanyfriends-association.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMGQH04fip7ImA9WxNbF0o.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-8503049289562895468</id><published>2009-11-15T22:16:00.000-08:00</published><updated>2009-11-20T20:07:01.336-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-20T20:07:01.336-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="selected index value" /><category scheme="http://www.blogger.com/atom/ns#" term="html drop down" /><category scheme="http://www.blogger.com/atom/ns#" term="dropdown options" /><category scheme="http://www.blogger.com/atom/ns#" term="dropdown selected" /><title>Drop down methods</title><content type="html">java script methods for drop down.&lt;br /&gt;&lt;br /&gt;selectedIndex - to get the selected index value&lt;br /&gt;options[].value - to get the value of the selected item&lt;br /&gt;options[].text - to get the option for the selected item&lt;br /&gt;&lt;br /&gt;ex:&lt;br /&gt;&lt;select id="id_of_dropdown_box"&gt;&lt;br /&gt;&lt;option value="1"&gt;Ruby&lt;/option&gt;&lt;br /&gt;&lt;option selected="selected" value="2"&gt;Rails&lt;/option&gt;&lt;br /&gt;&lt;option value="3"&gt;Java&lt;/option&gt;&lt;br /&gt;&lt;option value="4"&gt;php&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;br /&gt;var list_box = document.getElementById('id_of_dropdown_box');&lt;br /&gt;list_box.selectedIndex; --&gt; returns the value of selected index(drop down index starts from 0) '1' &lt;a href="#" onclick="alert(document.getElementById('id_of_dropdown_box').selectedIndex); return false;"&gt;check&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;options[0].value --&gt; value of the zero th element '1' &lt;a href="#" onclick="alert(document.getElementById('id_of_dropdown_box').options[0].value); return false;"&gt;check&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;options[0].text --&gt; text of the zero th element 'Ruby' &lt;a href="#" onclick="alert(document.getElementById('id_of_dropdown_box').options[0].text); return false;"&gt;check&lt;/a&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-8503049289562895468?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/yOFjkdoQ2IwcxQTmpbqFSZL0u14/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yOFjkdoQ2IwcxQTmpbqFSZL0u14/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/yOFjkdoQ2IwcxQTmpbqFSZL0u14/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yOFjkdoQ2IwcxQTmpbqFSZL0u14/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/hIkOrN5vtjM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/8503049289562895468/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/11/drop-down-methods.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8503049289562895468?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/8503049289562895468?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/hIkOrN5vtjM/drop-down-methods.html" title="Drop down methods" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/11/drop-down-methods.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04ARHk5fCp7ImA9WxNbE0g.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-5930900907493365068</id><published>2009-11-15T22:10:00.001-08:00</published><updated>2009-11-15T22:12:25.724-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-15T22:12:25.724-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby" /><category scheme="http://www.blogger.com/atom/ns#" term="array collect" /><category scheme="http://www.blogger.com/atom/ns#" term="yield" /><title>ruby - 'yield' method</title><content type="html">Hi Guys,&lt;br /&gt;&lt;br /&gt;Hope most of our ROR developers are using 'yield' method in the layout file. In ruby we are not using the yield method(called from any method). I have come across the 'yield' method, its very interesting to know about the use of that method.&lt;br /&gt;&lt;br /&gt;We can use 'yield' method inside any ruby method to execute the code inside the block.&lt;br /&gt;&lt;br /&gt;example-1:&lt;br /&gt;class Sample&lt;br /&gt;    def check_yield&lt;br /&gt;        yield&lt;br /&gt;        yield&lt;br /&gt;        yield&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;in the class 'Sample', i have called the yield method three times inside the method.&lt;br /&gt;&lt;br /&gt;obj = Sample.new()&lt;br /&gt;obj.check_yield{puts "hi am in method block"}&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;hi am in method block&lt;br /&gt;hi am in method block&lt;br /&gt;hi am in method block&lt;br /&gt;&lt;br /&gt;Now i have created an object for the class 'Sample', and called the method 'check_yield' with the block({ }). When i executed the method it prints the results for three times. Because we are calling the yield for three times, the call to yield method executes the code inside the block({puts "hi am in method block"}). That's it.&lt;br /&gt;&lt;br /&gt;We can also use the yield method with params.&lt;br /&gt;&lt;br /&gt;example-2:&lt;br /&gt;class Sample&lt;br /&gt;    def even_nos_upto(param)&lt;br /&gt;        for i in 0..param&lt;br /&gt;            yield(i) if i%2 == 0&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;obj = Sample.new()&lt;br /&gt;obj.even_nos_upto(10){|x| puts x}&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;0&lt;br /&gt;2&lt;br /&gt;4&lt;br /&gt;6&lt;br /&gt;8&lt;br /&gt;10&lt;br /&gt;&lt;br /&gt;In Array, we are using the method 'collect', 'each' to get each value of the array.&lt;br /&gt;&lt;br /&gt;[1,2,3,4,5].collect{|x| puts x}&lt;br /&gt;&lt;br /&gt;Inside the collect method in Array class, the yield method called to return each value.&lt;br /&gt;&lt;br /&gt;class Array&lt;br /&gt;    def my_collect&lt;br /&gt;        for i in 0..(self.length-1)&lt;br /&gt;            value = self[i]&lt;br /&gt;            yield(value)&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;    def collect_greater_than(limit)&lt;br /&gt;        for i in 0..(self.length-1)&lt;br /&gt;            value = self[i]&lt;br /&gt;            yield(value) if value &gt; 5&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;[1,2,3,4,5,6,7].collect{|x| puts x} # default method collect&lt;br /&gt;[1,2,3,4,5,6,7].my_collect{|x| puts x} # method my_collect&lt;br /&gt;[1,2,3,4,5,6,7].collect_greater_than(5){|x| puts x} # collect with condition&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;&lt;br /&gt;In the above sample, the method 'collect' &amp; 'my_collect' works like a same. And the method collect_greater_than bit different from the first one, it returns the values based on the condition we have used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-5930900907493365068?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iCdyeVBDlZrx3ahquFmzHVWaJzg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iCdyeVBDlZrx3ahquFmzHVWaJzg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iCdyeVBDlZrx3ahquFmzHVWaJzg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iCdyeVBDlZrx3ahquFmzHVWaJzg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/jqyz8nAu7iE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/5930900907493365068/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/11/ruby-yield-method.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5930900907493365068?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/5930900907493365068?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/jqyz8nAu7iE/ruby-yield-method.html" title="ruby - 'yield' method" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/11/ruby-yield-method.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAAQHw6eyp7ImA9WxNVGUo.&quot;"><id>tag:blogger.com,1999:blog-7962756704981038195.post-4573451971809768436</id><published>2009-10-30T21:03:00.000-07:00</published><updated>2009-10-31T01:45:41.213-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T01:45:41.213-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby" /><category scheme="http://www.blogger.com/atom/ns#" term="model association" /><category scheme="http://www.blogger.com/atom/ns#" term="Polymorphic relation" /><category scheme="http://www.blogger.com/atom/ns#" term="rails" /><category scheme="http://www.blogger.com/atom/ns#" term="has_many relation" /><title>has many polymorphic - double sided</title><content type="html">I have used the following model relation to get the has many polymorphic double sided relation.&lt;br /&gt;&lt;br /&gt;class Album &lt; ActiveRecord::Base&lt;br /&gt;    has_many :album_files, :dependent =&gt; :destroy, :foreign_key =&gt; "album_id", :class_name =&gt; "AlbumFile"&lt;br /&gt;    has_many :photos, :source =&gt; :file, :through =&gt; :album_files, :source_type =&gt; "Photo", :class_name =&gt; "Photo"   &lt;br /&gt;    has_many :videos, :source =&gt; :file, :through =&gt; :album_files, :source_type =&gt; "Viedo", :class_name =&gt; "Video"   &lt;br /&gt;end&lt;br /&gt;class AlbumFile &lt; ActiveRecord::Base&lt;br /&gt;    belongs_to :file, :polymorphic =&gt; true&lt;br /&gt;end&lt;br /&gt;class Photo &lt; ActiveRecord::Base&lt;br /&gt;    has_many :album_files, :dependent =&gt; :destroy, :as =&gt; :file&lt;br /&gt;    has_many :albums, :source =&gt; :album, :foreign_key =&gt; "album_id", :through =&gt; :album_files, :class_name =&gt; "Album"&lt;br /&gt;end&lt;br /&gt;class Video &lt; ActiveRecord::Base&lt;br /&gt;    has_many :album_files, :dependent =&gt; :destroy, :as =&gt; :file&lt;br /&gt;    has_many :albums, :source =&gt; :album, :foreign_key =&gt; "album_id", :through =&gt; :album_files, :class_name =&gt; "Album"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;thats it..&lt;br /&gt;&lt;br /&gt;Now we have associated Album with photos, videos through the mapping table album_files.&lt;br /&gt;&lt;br /&gt;Following  works for this&lt;br /&gt;&lt;br /&gt;album = Album.create()&lt;br /&gt;album.photos &lt;&lt; Photo.create()&lt;br /&gt;album.vidoes &lt;&lt; Video.create()&lt;br /&gt;&lt;br /&gt;album.album_files.count - returns the total count i.e, 2&lt;br /&gt;&lt;br /&gt;album.photos - returns the count 1&lt;br /&gt;album.vidoes - returns the count 1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7962756704981038195-4573451971809768436?l=vaddi-blog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uKolSdBdDlDntLeKZb2j-PxbRgA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uKolSdBdDlDntLeKZb2j-PxbRgA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uKolSdBdDlDntLeKZb2j-PxbRgA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uKolSdBdDlDntLeKZb2j-PxbRgA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/VadivelanRubyOnRailsBlog/~4/5NPmQtXfgCs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vaddi-blog.blogspot.com/feeds/4573451971809768436/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://vaddi-blog.blogspot.com/2009/10/has-many-polymorphic-double-sided.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4573451971809768436?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7962756704981038195/posts/default/4573451971809768436?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/VadivelanRubyOnRailsBlog/~3/5NPmQtXfgCs/has-many-polymorphic-double-sided.html" title="has many polymorphic - double sided" /><author><name>vadivelan</name><uri>http://www.blogger.com/profile/02758945019387741771</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://vaddi-blog.blogspot.com/2009/10/has-many-polymorphic-double-sided.html</feedburner:origLink></entry></feed>

