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

<channel>
	<title>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India</title>
	<atom:link href="http://vinsol.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 26 Jul 2010 08:37:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Meet Vinsol at RailsConf 2010</title>
		<link>http://vinsol.com/blog/2010/05/21/meet-vinsol-at-railsconf-2010/</link>
		<comments>http://vinsol.com/blog/2010/05/21/meet-vinsol-at-railsconf-2010/#comments</comments>
		<pubDate>Fri, 21 May 2010 12:44:46 +0000</pubDate>
		<dc:creator>kapil</dc:creator>
				<category><![CDATA[railsconf]]></category>
		<category><![CDATA[railsconf10]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=927</guid>
		<description><![CDATA[Vinsol will be attending the RailsConf 2010 (June 7 – June 10).
Manik, Rishav and Gaurav will be there in Baltimore learning cool stuff and interacting with some cool rails developers. If you happen to be around, we would like to meet you!  Drop us a comment, an e-mail , or catch  Vinsol on [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><br/>Vinsol will be attending the <a href="http://en.oreilly.com/rails2010">RailsConf 2010</a> (June 7 – June 10).<br />
Manik, Rishav and Gaurav will be there in Baltimore learning cool stuff and interacting with some cool rails developers. If you happen to be around, we would like to meet you!  Drop us a comment, an <a href="mailto:manik@vinsol.com">e-mail</a> , or catch  <a href="http://www.twitter.com/the_vinsol">Vinsol </a>on Twitter.<br/><br/></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2010/05/21/meet-vinsol-at-railsconf-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading Restful Authentication Plugin for Rails 3</title>
		<link>http://vinsol.com/blog/2010/04/23/upgrading-restful-authentication-plugin-for-rails-3/</link>
		<comments>http://vinsol.com/blog/2010/04/23/upgrading-restful-authentication-plugin-for-rails-3/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 06:57:59 +0000</pubDate>
		<dc:creator>kapil</dc:creator>
				<category><![CDATA[Rails 3]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[restful]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=912</guid>
		<description><![CDATA[Here at Vinsol, we love to be on cutting edge of Ruby on Rails.  
When I tried to use restful authentication generator plugin for Rails 3 app, I got &#8216;Could not find generator authenticated&#8217; error. Generator system in Rails3 is now replaced with T﻿hor  which is a scripting framework that replaces rake and [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Here at Vinsol, we love to be on cutting edge of Ruby on Rails. <br/> <br/></p>
<p>When I tried to use restful authentication generator plugin for Rails 3 app, I got &#8216;Could not find generator authenticated&#8217; error. Generator system in Rails3 is now replaced with <a href="http://github.com/wycats/thor">T﻿hor </a> which is a scripting framework that replaces rake and sake. Rails 2.x.x finds generators in generators/ or rails_generators/ directory of a gem or a plugin, but the new Thor based system looks for lib/generators/ or lib/rails_generators/ directory.<br/> <br/></p>
<p>I forked the original restful-authentication plugin and did the necessary changes to make it compatible with Rails 3.0.0.beta3. Updated code is available at <a href="http://github.com/Satish/restful-authentication">http://github.com/Satish/restful-authentication</a> and the original project page is <a href="http://github.com/technoweenie/restful-authentication">here</a>.<br/></p>
<p>Comments welcome. <br/><br/></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2010/04/23/upgrading-restful-authentication-plugin-for-rails-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Introduction to Active Scaffold  Part I</title>
		<link>http://vinsol.com/blog/2010/04/09/introduction-to-active-scaffold-part-i/</link>
		<comments>http://vinsol.com/blog/2010/04/09/introduction-to-active-scaffold-part-i/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 11:12:32 +0000</pubDate>
		<dc:creator>payal</dc:creator>
				<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=826</guid>
		<description><![CDATA[I originally wrote this article for fifth issue of  Rails Magazine. In addition to print version, you can download all issues of Rails Magazine in pdf for free. Not only that, they also allow authors to self-publish their articles on blogs etc. after 30 days of issue release. I hope rails beginners will particularly [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><em>I originally wrote this article for fifth issue of <a href="http://railsmagazine.com/issues/5"> Rails Magazine</a>. In addition to print version, you can download <a href="http://railsmagazine.com/issues">all issues of Rails Magazine</a> in pdf for free. Not only that, they also allow authors to self-publish their articles on blogs etc. after 30 days of issue release. I hope rails beginners will particularly find this post useful. </em><br />
<br/><br />
In this two-part series, I will trying to explain Active Scaffold from the ground up using a real world example.</p>
<p><strong>Introduction</strong></p>
<p><a href="http://www.activescaffold.com/">ActiveScaffold</a> is a rails plugin that generates an ajaxified management interface based on the database tables.  It is an incredibly powerful, configuration-driven framework that automatically provides all CRUD operations. It is easily and highly configurable. Let us have a walkthrough of active scaffold with details on configurability and customization options it provides using a sample application. The demo application which we are going to develop is a management site for a sports club.</p>
<p><strong>Configuration</strong></p>
<p>Here our example is about building an administration panel for a sports club “mysportsclub”. It consists of sports, players, coaches and equipments. There are various kinds of sports in the club. Each player can have membership for any number of sports. Each sport will have one trained coach for guidance and various equipments which will be issued to the players. Let’s begin with the implementation of “mysportsclub”</p>
<p>Let’s setup our rails application “mysportsclub”. Run the following commands:</p>
<p style="padding-left: 30px">
<pre class="brush: ruby;">rails mysportsclub</pre>
<p>Install the latest version of the plugin which is compatible with latest stable rails (2.3.x):</p>
<p style="padding-left: 30px">
<pre class="brush: ruby;">script/plugin install git://github.com/activescaffold/active_scaffold.git</pre>
<p><span style="color: #800000">Note: Latest active scaffold version works only with rails version higher than 2.2. Also, install <strong>render_component</strong> plugin since it is now removed from rails 2.3 but used by active scaffold.</span></p>
<p><strong>Layout</strong>:</p>
<p>This is the standard active scaffold layout <em>admin.html.erb</em>:</p>
<pre class="brush: ruby;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
       &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
   &lt;title&gt;My Sports Club&lt;/title&gt;
   &lt;%= javascript_include_tag :defaults %&gt;
   &lt;%= active_scaffold_includes %&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;%= yield %&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Model/Migrations</strong>:</p>
<pre class="brush: ruby;">script\generate model sport name:string description:text coach_id:integer
script\generate model player name:string date:birth_date
script\generate model equipment name:string sport_id:integer
script\generate model coach name:string
script\generate model players_sport player_id:integer sport_id:integer

rake db:migrate
</pre>
<p>Add the following code to the respective models. This code defines the associations for the various models:</p>
<p><strong><em>sports.rb</em></strong></p>
<pre class="brush: ruby;">class Sport &lt; ActiveRecord::Base
  belongs_to :coach
  has_many	:equipments, :dependent =&gt; :destroy

  has_many	:players_sports, :dependent =&gt; :destroy
  has_many	:players, :through	=&gt; :players_sports

  validates_presence_of	:name
  validates_uniqueness_of	:name
end</pre>
<p><strong><em>coach.rb</em></strong></p>
<pre class="brush: ruby;">class Coach &lt; ActiveRecord::Base
  has_one	:sport
  validates_presence_of	:name
end</pre>
<p><strong><em>player.rb</em></strong></p>
<pre class="brush: ruby;">class Player &lt; ActiveRecord::Base
  has_many	:players_sports, :dependent =&gt; :destroy
  has_many	:sports, :through	=&gt; :players_sports

  validates_presence_of	:name
end</pre>
<p><strong>equipment.rb</strong></p>
<pre class="brush: ruby;">class Equipment &lt; ActiveRecord::Base
  belongs_to	:sport
  validates_presence_of	:name
end</pre>
<p><strong><em>players_sport.rb</em></strong></p>
<pre class="brush: ruby;">class PlayersSport &lt; ActiveRecord::Base
  belongs_to	:player
  belongs_to	:sport
end</pre>
<p><strong>Note I</strong></p>
<p>Don’t forget to add the plural form of “equipment” as “equipments” in the config/intializers/inflections.rb.</p>
<pre class="brush: ruby;"> ActiveSupport::Inflector.inflections do |inflect|
   inflect.plural &quot;equipment&quot;, &quot;equipments&quot;
 end</pre>
<p>Active Scaffold will throw an exception if we do not define the above inflection rule.  The controller generated for the ‘Equipment’ model will be ‘EquipmentsController’. But since active scaffold generates the controller name automatically using its inbuilt function: “active_scaffold_controller_for(class_name_of_the_model)”. It will not be able to guess the correct controller name and would throw an exception while we try to access the nested equipments:</p>
<p><strong>Controllers</strong>:</p>
<pre class="brush: ruby;">script\generate controller sports
script\generate controller coaches
script\generate controller equipments
script\generate controller players</pre>
<p>Add the following code to your controllers:</p>
<p><strong><em>sports_contrpller.rb</em></strong></p>
<pre class="brush: ruby;">class SportsController &lt; ApplicationController
  active_scaffold :sport do |config|
    config.columns = [:name, :description, :coach, :equipments]
  end
end</pre>
<p><strong><em>coaches_controller.rb</em></strong></p>
<pre class="brush: ruby;">class CoachesController &lt; ApplicationController
  active_scaffold :coach do |config|
    config.columns = [:name, :sport]
  end
end</pre>
<p><strong>players_controller.rb</strong></p>
<pre class="brush: ruby;">class PlayersController &lt; ApplicationController
  active_scaffold :player do |config|
    config.columns = [:name]
  end
end</pre>
<p><strong><em>equipments_controller.rb</em></strong></p>
<pre class="brush: ruby;">class EquipmentsController &lt; ApplicationController
  active_scaffold :equipment	do |config|
    config.columns = [:name, :sport]
  end
end</pre>
<p><strong><em>players_sports_controller.rb</em></strong></p>
<pre class="brush: ruby;">class PlayersSportsController &lt; ApplicationController
  active_scaffold :players_sport do |config|
    config.columns = [:sport, :player]
  end
end</pre>
<p><strong><em>routes.rb</em></strong></p>
<pre class="brush: ruby;">map.root :controller =&gt; 'sports', :action =&gt; 'index'

map.resources :sports, :active_scaffold =&gt; true
map.resources :players, :active_scaffold =&gt; true
map.resources :players_sports, :active_scaffold =&gt; true
map.resources :coaches, :active_scaffold =&gt; true
map.resources :equipments, :active_scaffold =&gt; true
</pre>
<p>The above code will generate a complete interface for our club.</p>
<p>Following code for your layout will provide a navigation bar in your view.</p>
<p><strong>admin.html.erb</strong></p>
<pre class="brush: ruby;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
  &lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/&gt;
    &lt;%= stylesheet_link_tag 'admin.css' %&gt;
    &lt;%= javascript_include_tag :defaults %&gt;
    &lt;%= active_scaffold_includes %&gt;
    &lt;title&gt;&lt;%= &quot;Admin&quot; %&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div&gt;
      &lt;div&gt;
        &lt;h2&gt;Agent Website Admin Panel&lt;/h2&gt;
        &lt;div&gt;
          &lt;ul class=&quot;links&quot;&gt;
            &lt;li&gt;
              &lt;%= link_to 'Sports', sports_path %&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;%= link_to 'Players', players_path %&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;%= link_to 'Coaches', coaches_path %&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;%= link_to 'Equipments', equipments_path %&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;%= link_to 'PlayersSports', playerssports_path %&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
          &lt;div class=&quot;clear&quot;&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id=&quot;content&quot;&gt;
        &lt;div id=&quot;main&quot;&gt;
          &lt;%= yield %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>There are various customization options available. As per our requirement we can customize the columns, links, fields, actions etc. We would discuss them in the concluding part of the series.</p>
<p><br/></p>
<table>
<td><img src="http://vinsol.com/components/com_staffmaster/images/payal.jpg"/></td>
<td>Payal Gupta is working working as software engineer with Vinsol. She has over two years of industry<br />
experience. </td>
</table>
<p><br/></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2010/04/09/introduction-to-active-scaffold-part-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSL checklist for Ruby on Rails Applications</title>
		<link>http://vinsol.com/blog/2010/04/01/ssl-checklist-for-rails-applications/</link>
		<comments>http://vinsol.com/blog/2010/04/01/ssl-checklist-for-rails-applications/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 08:59:02 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=857</guid>
		<description><![CDATA[Cross posted from darthsid
The purpose of SSL is to provide a reasonable level of protection against eavesdropping and man-in-the-middle attacks. Although SSL provides a greater level of security, it introduces a lot of overheads and hence should be used sparingly.  Two of the most common places to use SSL is for payment transactions and [...]


Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
<li><a href='http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/' rel='bookmark' title='Permanent Link: 11 Things to Consider Before Deploying Your Ruby on  Rails Application'>11 Things to Consider Before Deploying Your Ruby on  Rails Application</a> <small>At VinSol, we have been developing and deploying Rails applications...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Cross posted from <a title="Sid's Blog" href="http://darthsid.com/blog">darthsid</a></p>
<p>The purpose of SSL is to provide a reasonable level of protection against eavesdropping and man-in-the-middle attacks. Although SSL provides a greater level of security, it introduces a lot of overheads and hence should be used sparingly.  Two of the most common places to use SSL is for payment transactions and user registration/login.<br />
This post intentionally focuses only on the Rails application as there are numerous post on the net for SSL setup on the server. Enabling SSL in a Rails application is really trivial and there are just a few points that need your attention..<br />
<span id="more-857"></span><br />
<big><big><strong>1. Enabling SSL</strong></big></big><br />
<big>a. Install the <em>ssl_requirment</em> plugin:</big></p>
<pre class="brush: bash;">
./script/plugin install git://github.com/rails/ssl_requirement.git
</pre>
<p><big>b. Include it in your <em>application_controller.rb</em>:</big></p>
<pre class="brush: ruby;">
include SslRequirement
</pre>
<p><big>c. Specify actions that require SSL in their respective controllers. For eg. my session controller has the following line:</big></p>
<pre class="brush: ruby;">
ssl_required  :new, :create if Rails.env.production?
</pre>
<p><big>d. Add the following line in <i>development.rb</i> to bypass SSL in development mode:</big></p>
<pre class="brush: ruby;">
SslRequirement.disable_ssl_check = true
</pre>
<p><big><big><strong>2. Gotcha&#8217;s</strong></big></big><br />
<big>a. Include all submit actions in requirement</big><br />
Any action that processes form data from a SSL page should also be added to the requirement. In the above example, the form on the login page(<em>new</em> action) is processed by the <em>create</em> action and hence it is also included in the requirement.<br />
<big>b. Ajax actions</big><br />
Ajax actions on a SSL page should also use SSL and must be included in the requirement. At times you do not have a body for the Ajax action and it is rendered using it&#8217;s respective RJS template. In such cases create an empty action and include it in the <em>ssl_requirement</em>.<br />
<big>c. Mixed content</big><br />
A lot of browsers show you a &#8220;Mixed Content Warning&#8221; if your SSL page references non-SSL assets. IE displays a scary looking confirmation dialog while Firefox and Chrome show a exclamation in the url bar. Any relative paths(eg. using _path helpers) on the page will automatically use the https protocol but any absolute paths(eg. using _url helper or by manually specifying as a string in link_to) will need to be changed to use https.<br />
<big>d. Asset host issue</big><br />
If you are using Rails asset hosts and do not have a SSL certificate that supports wildcard(for subdomains), then you need to disable them for the SSL pages. Just add the following code to your <em>production.rb</em>:</p>
<pre class="brush: ruby;">
ActionController::Base.asset_host = Proc.new { |source, request|
  if request.ssl?
    &amp;amp;quot;#{request.protocol}#{request.host_with_port}&amp;amp;quot;
  else
    &amp;amp;quot;#{request.protocol}assets%d.yourdomain.com&amp;amp;quot; % (source.hash % 4)
  end
}
</pre>
<p>Replace <em>&#8220;yourdomain&#8221;</em> with your apps domain and <em>&#8220;4&#8243;</em> with the number of asset hosts required.</p>
<p>The above should ensure that you have a proper SSL setup without displaying warnings to the user.</p>


<p>Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
<li><a href='http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/' rel='bookmark' title='Permanent Link: 11 Things to Consider Before Deploying Your Ruby on  Rails Application'>11 Things to Consider Before Deploying Your Ruby on  Rails Application</a> <small>At VinSol, we have been developing and deploying Rails applications...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2010/04/01/ssl-checklist-for-rails-applications/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Jquery Full Calendar with Ruby on Rails</title>
		<link>http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/</link>
		<comments>http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 12:17:25 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[calendar]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=834</guid>
		<description><![CDATA[Contrary to popular belief, working on a client project gives us a generous margin of creativity and explore innovative solutions. Take the example of a recent project I was working on. The client required a collaboration-based calendar module for their application similar to Google Calendar. Initially we started developing it from scratch , but then, [...]


Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Contrary to popular belief, working on a client project gives us a generous margin of creativity and explore innovative solutions. Take the example of a recent project I was working on. The client required a collaboration-based calendar module for their application similar to Google Calendar. Initially we started developing it from scratch , but then, we found an awesome Jquery plugin. <br/> <br/></p>
<p>&#8220;<a href="http://arshaw.com/fullcalendar/">FullCalendar</a>&#8221; provides a full-sized, drag &amp; drop calendar. It uses AJAX to fetch events on-the-fly for each month. It also supports an intuitive interface to manage events that spans over multiple days or weeks. It is visually customizable and exposes hooks for user-triggered events (like clicking or dragging an event). <br/> <br/></p>
<p>I decided to give it a try and utilize its hooks for user triggered events within our Rails application. This small effort resulted in a barebone Rails app that might provide a good base for your project which require calendar, scheduling or appointment features.  I called it fullcalendar_rails  and it is now available on <a href="http://github.com/vinsol/fullcalendar_rails">github</a> with a working demo at <a href="http://fullcalendar.vinsol.com">http://fullcalendar.vinsol.com</a>.<br/><br/></p>
<p>Feel free to give your valuable feedback. I hope you will find this useful. <br/><br/></p>
<p><b>Update:</b> On popular demand, I have added recurring events functionality with daily, weekly and monthly frequencies. It also allows for exceptions to recurring events including delete and edit features.</p>
<p><br/><br/></p>


<p>Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>11 Things to Consider Before Deploying Your Ruby on  Rails Application</title>
		<link>http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/</link>
		<comments>http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 21:13:46 +0000</pubDate>
		<dc:creator>kapil</dc:creator>
				<category><![CDATA[deployment]]></category>
		<category><![CDATA[checklist]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=787</guid>
		<description><![CDATA[At VinSol, we have been developing and deploying Rails applications for more than four years. During this period, we  have identified some best practices that we prefer to follow while deploying  rails application to production server.
Below is the checklist of these practices:
 &#160; 
1. Ensure that NS records and MX records are changed if they [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>At VinSol, we have been developing and deploying Rails applications for more than four years. During this period, we  have identified some best practices that we prefer to follow while deploying  rails application to production server.</p>
<p>Below is the checklist of these practices:</p>
<p> &nbsp; </p>
<p><strong>1. </strong><strong>Ensure that NS records and MX records are changed if they need to be changed</strong></p>
<p>Changing nameservers will point the domain to the hosting server,  and changing MX records will redirect incoming mails to the mail server. As a very first step, we should make sure that name servers of the domain are set to be the correct one.  Changing MX record is a must if our application is parsing incoming mails or we wants to use other mail services for e-mail exchange, for example Gmail.</p>
<p> &nbsp; </p>
<p><strong>2. Ensure some backup mechanism in place for both data as well as user uploaded content like images/documents etc.</strong></p>
<p>Since production data is very critical, we must setup backup  mechanism. It could be some type of scheduled task that takes periodic backup of all critical data, Or it could be some type of backup service provided by hosting company. When we talk about critical production data, it includes production DB, content generated by application users like images, documents, etc.</p>
<p> &nbsp; </p>
<p><strong>3. Ensure database indexes</strong></p>
<p>We might have done development without having proper database indexes, but we should avoid going to production without them. Adding indexes might slow down insert queries a bit but it increases the  performance of read queries. It applies when application in production has percentage of read operations much more than write operations.</p>
<p> &nbsp; </p>
<p><strong>4. Enable your slow query log</strong></p>
<p>This is specific to MySQL. Enabling slow query log allows MySQL to log slow running queries to a file. And this log can be used to find queries that take a long time to execute and are therefore candidates for optimization.</p>
<p> &nbsp; </p>
<p><strong>5. Ensure exception capturing is in place</strong></p>
<p>We might want to be notified when something bad happens to our application. There are several hosted services available who receive and track exceptions, for example <a href="hoaptoadapp.com" target="_blank">Hoptoadapp.com</a>,<a href="http://getexceptional.com/"> GetExceptional.com</a> etc&#8230;  Either we can choose one from these hosted services or we can use <a href="http://agilewebdevelopment.com/plugins/exception_notifier">“exception notifier”</a> plugin.</p>
<p> &nbsp; </p>
<p><strong>6. Ensure adding entries for cron/scheduled jobs</strong></p>
<p>Most of the applications have some functionality/jobs that need to be run periodically, for example generating invoices, sending newsletters etc.  In most cases these jobs are done by a rake task. We should make sure that we have added such jobs to cron or similar program.</p>
<p> &nbsp; </p>
<p><strong>7.  Monitoring important processes</strong></p>
<p>To ensure that our site is up 24&#215;7 we need to ensure that all processes that our application needs are up. There can be many processes like MySQL, Mongrel, Apache etc.. These processes are very important as our application directly depends on them. For example if MySQL process get killed accidentally, our application would not be able to connect to MySQL and will start throwing exceptions.</p>
<p>We can choose any of the available monitoring tools like God, Monit, 24&#215;7 etc&#8230;</p>
<p> &nbsp; </p>
<p><strong>8. Ensure confidential data filtering</strong></p>
<p>We would never like to leak/share confidential information of our application users. We should make sure that none of the user&#8217;s confidential data like SSN, Credit card info, password are being written to log files. We might not have paid much attention on this while developing the application.</p>
<p> &nbsp; </p>
<p><strong>9. Rotate log files</strong></p>
<p>Once our site is up and running, every single request write some text in log file. And hence size of the  log file keeps on increasing. Larger log files can put us in trouble if we get it beyond certain size. Its difficult to manage these log files, as larger files need more memory to open and need more time to download. In one of the rescue project we did , the log file size was 3GB.</p>
<p>We would recommend having<a href="http://www.nullislove.com/2007/09/10/rotating-rails-log-files/"> logrotate setup</a> for the application.</p>
<p> &nbsp; </p>
<p><strong>10. Setup Asset Host </strong></p>
<p>Setting up asset hosts can reduce loading time by 50% or more. We must setup asset hosts for our application. Once asset hosts are all set, our static files will be delivered via asset hosts for example asset1.hostname.com, asset2.hostname.com</p>
<p> &nbsp; </p>
<p><strong>11. Clearing up stale sessions</strong></p>
<p>We should make sure we should not left any stale session on the server. If our application is using DB or file system  as session store, we must add a schedule task to delete stale sessions.</p>
<p>These are some of the points we have identified from our past experience and we might be missing some. Feel free to  always add them as comments, and I&#8217;ll keep this post updated.</p>
<hr size = 2 width = "98%" style="border-top:2px dotted grey; margin: 5px;"/>
<img src="http://www.gravatar.com/avatar/174330d280860a6ad77a6d15dd7fabe1?s=96&#038;d=wavatar&#038;r=G" height="50" align="left" hspace="10" vpsace="10" /> <a href="http://www.webonrails.com" target="_blank"> Akhil </a> is a senior software engineer working with Vinsol for last 5 years. He is an inhouse deployment ninja.</p>
<div style ="clear:both"> &nbsp;</div>
<hr size = 2 width = "98%" style="border-top:2px dotted grey; margin: 5px;"/>
<p> &nbsp; </p>
<p>We also provide affordable <a href="http://vinsol.com/rails-deployment-services"> rails deployment services</a>.  </p>
<p> &nbsp; </p>
<p> &nbsp; </p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>10 little known ways to find a ruby on rails team for your next project</title>
		<link>http://vinsol.com/blog/2009/11/12/10-little-known-ways-to-find-a-ruby-on-rails-team-for-your-next-project/</link>
		<comments>http://vinsol.com/blog/2009/11/12/10-little-known-ways-to-find-a-ruby-on-rails-team-for-your-next-project/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 11:48:47 +0000</pubDate>
		<dc:creator>kapil</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=778</guid>
		<description><![CDATA[Everytime we talk to our clients, we find that they are not aware of lot of options through which they can find a good rails developer. Usually clients go to odesk and other freelance websites to find rails developers. Following are  10 more ways to find  rails company/developer for your next dream project :

 Post [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Everytime we talk to our clients, we find that they are not aware of lot of options through which they can find a good rails developer. Usually clients go to <a href="www.odesk.com" target="_blank">odesk</a> and other freelance websites to find rails developers. Following are  10 more ways to find  rails company/developer for your next dream project :</p>
<ol>
<li> Post your requirements on twitter with hashtag #ruby #ror #rails</li>
<li> Go to <a href="http://www.railsdevelopment.com ">Railsdevelopment.com </a>- its a directory of rails companies. You can search for specific services with your budget ranges.</li>
<li><a href="http://www.workingwithrails.com/browse/companies">Working with Rails</a> &#8211; Again a directory of rails developers and companies. You can browse through specific industry categories.</li>
<li>Local Ruby Meetups &#8211; The most passionate guys are always there in local meetups. For eg: we have <a href="http://www.meetup.com/delhi-ruby">delhi ruby </a>meetups and you can find all local meetups in <a href=" http://rubyonrails.com.au/" target="_blank">australia here </a></li>
<li><a href="http://www.railsmaturitymodels.com/"></a></li>
<li>RubyJobs &#8211; Post a job on <a href="http://jobs.rubynow.com/" target="_blank">rubyjobs</a> or <a href="http://jobs.rubyinside.com/a/jbb/find-jobs">rubyinside</a> job board. There are some country specific ruby job boards.</li>
<li>RubyonRails wiki &#8211; There is a<a href="http://newwiki.rubyonrails.org/rails/pages/developmentfirms#asia" target="_blank"> wiki of ruby on rails </a>companies.</li>
<li>Open Source Contributions &#8211; Sites like <a href="agilewebdevelopment.com" target="_blank">http://agilewebdevelopment.com/</a> gives you a directory of rails plugins. Open Source contributions such as releasing a Rails plugin, or fixing bugs on projects , or Rails itself, demonstrates exposure to other Rails code bases and quality of a developer. Search for developer name in <a href="http://www.github.com">github</a>.</li>
<li>Conferences &#8211; Conferences are good way to find<a href="http://weblog.rubyonrails.org/2009/7/18/ruby-rails-conferences-in-09"> quality rails developer </a>or team.</li>
<li>Facebook &#8211; Few people post jobs on<a href="http://www.facebook.com/board.php?uid=8537680906"> facebook. </a></li>
</ol>
<p>Few tips :</p>
<ul>
<li>Don&#8217;t hire someone that doesn&#8217;t know Rails at all. Yes, we have seen some people doing it.</li>
<li>Ask for references of previous clients if possible in your country.</li>
<li>Look for someone who values the money you are paying them and will make your investment in them provide a valuable return.</li>
<li>A personal Rails blog is a good indicator of  developer&#8217;s interests , experience and resume.</li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/11/12/10-little-known-ways-to-find-a-ruby-on-rails-team-for-your-next-project/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Integrating Yahoo! BOSS with your ruby on rails application</title>
		<link>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/</link>
		<comments>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:08:05 +0000</pubDate>
		<dc:creator>amit</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[yahoo boss]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=740</guid>
		<description><![CDATA[What is Yahoo! BOSS? Yahoo developer website cites it as:
&#8220;Yahoo! Search BOSS (Build your Own Search Service) is an initiative in Yahoo! Search to open up Yahoo!&#8217;s search infrastructure and enable third parties to build revolutionary search products leveraging their own data, content, technology, social graph, or other assets. This release includes Web, News, and [...]


Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>What is <strong>Yahoo! BOSS</strong>? Yahoo developer website cites it as:</p>
<p style="text-align:justify"><cite>&#8220;Yahoo! Search BOSS (Build your Own Search Service) is an initiative in Yahoo! Search to open up Yahoo!&#8217;s search infrastructure and enable third parties to build revolutionary search products leveraging their own data, content, technology, social graph, or other assets. This release includes Web, News, and Image Search as well as Spelling Suggestions.&#8221;</cite></p>
<p>Some of the possible implementation of Yahoo! Boss may be finding related posts for your article, suggested tag/category for an article/query, correcting misspelled words by providing suggestions, fetching latest news on a topic dynamically, search over delicious tags, customized language search. Some of these have been tried and successfully implemented. An example is the <a href="http://www.techcrunch.com/2008/11/26/techcrunchs-new-search-engine-powered-by-yahoo-boss/">TechCrunch&#8217;s Search Engine</a>.</p>
<p> Here is a concise guide on how to use this new service in your next rails application.</p>
<p><strong>Obtain API key</strong></p>
<p>Get an application key from <a href="http://developer.yahoo.com/search/boss/">http://developer.yahoo.com/search/boss/</a>.</p>
<p><strong>Install BOSSMan Gem</strong></p>
<p>BOSSMan is a gem for interaction with the Yahoo BOSS web service written by <a href="http://github.com/jpignata">John Pignata</a>. Install it using the following commands:</p>
<pre class="brush: bash;">
gem install gemcutter
gem tumble
gem install bossman
</pre>
<p><strong>Usage</strong></p>
<p>Put this in your environment.rb</p>
<pre class="brush: ruby;">
require 'bossman'
include BOSSMan
BOSSMan.application_id = &amp;lt;Your Application ID&amp;gt;
</pre>
<p><strong>Web Search</strong></p>
<p>Use the following code to execute search over the web:</p>
<pre class="brush: ruby;">
boss = Search.web(&amp;quot;Apple Pie&amp;quot;, { :count =&amp;gt; 2, :filter =&amp;gt; &amp;quot;-hate&amp;quot; })
puts &amp;quot;Number of results: #{boss.totalhits}&amp;quot;

boss.results.each do |result|
  puts &amp;quot;#{result.title}&amp;quot;
  puts &amp;quot;#{result.dispurl}&amp;quot;
  puts &amp;quot;#{result.abstract}&amp;quot;
end

# =&amp;gt; Number of results: 2618888
# =&amp;gt; &amp;lt;b&amp;gt;Apple&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;pie&amp;lt;/b&amp;gt; - Wikipedia, the free encyclopedia
# =&amp;gt; &amp;lt;b&amp;gt;en.wikipedia.org&amp;lt;/b&amp;gt;/wiki/&amp;lt;wbr&amp;gt;&amp;lt;b&amp;gt;Apple&amp;lt;/b&amp;gt;_&amp;lt;b&amp;gt;pie&amp;lt;/b&amp;gt;
# =&amp;gt; English &amp;lt;b&amp;gt;apple&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;pie&amp;lt;/b&amp;gt; recipes go back to the time of Chaucer. &amp;lt;b&amp;gt;...&amp;lt;/b&amp;gt; The basis of Dutch &amp;lt;b&amp;gt;apple&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;pie&amp;lt;/b&amp;gt; is a crust on the bottom and around the edges. &amp;lt;b&amp;gt;...&amp;lt;/b&amp;gt;

boss = Search.web(&amp;quot;Moon&amp;quot;, { :count =&amp;gt; 10, :type =&amp;gt; &amp;quot;nonhtml,-pdf&amp;quot; })

boss.results.each do |result|
  puts &amp;quot;#{result.title}&amp;quot;
  puts &amp;quot;#{result.dispurl}&amp;quot;
  puts &amp;quot;#{result.abstract}&amp;quot;
end

# =&amp;gt; BACKGROUND:
# =&amp;gt; www.&amp;lt;b&amp;gt;radford.edu&amp;lt;/b&amp;gt;/~rusmart/&amp;lt;wbr&amp;gt;&amp;lt;b&amp;gt;moon&amp;lt;/b&amp;gt;.doc
# =&amp;gt; We noticed was that one of the scan lines took longer to scan the &amp;lt;b&amp;gt;moon&amp;lt;/b&amp;gt; then any other. This occurred toward the middle of the &amp;lt;b&amp;gt;moon&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;...&amp;lt;/b&amp;gt;

boss = Search.web(&amp;quot;Star&amp;quot;, { :sites =&amp;gt; &amp;quot;wwe.com&amp;quot;, :style=&amp;gt;'raw' })
boss.results.each do |result|
  puts &amp;quot;#{result.title}&amp;quot;
  puts &amp;quot;#{result.dispurl}&amp;quot;
  puts &amp;quot;#{result.abstract}&amp;quot;
end

# =&amp;gt; John Cena - WWE: Raw
# =&amp;gt; www.&amp;lt;b&amp;gt;wwe.com&amp;lt;/b&amp;gt;/super&amp;lt;b&amp;gt;star&amp;lt;/b&amp;gt;s/raw/&amp;lt;wbr&amp;gt;johncena
# =&amp;gt; Official profile from WWE for the professional wrestler John Cena, who has been training since he was 15. Features lots of photos and video clips, including John ...
</pre>
<p>Apart from <a href="#universal_arguments">universal arguments</a> mentioned at the end of this document, the following arguments can also be used:<br />
<script>
function toggleDiv(divid){
if(document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
}else{
document.getElementById(divid).style.display = 'none';
}
}
</script></p>
<style>
#universal_arguments td, #universal_arguments th, #web_search_arguments td, #web_search_arguments th, #web_response_fields td, #web_response_fields th, #image_search_arguments td, #image_search_arguments th, #image_response_fields th, #image_response_fields td, #news_search_arguments th, #news_search_arguments td, #news_response_fields td, #news_response_fields th{padding: 5px; vertical-align:top;}
#web_search_arguments li {list-style-type:none; background: none}
</style>
<table border="0" cellspacing="0" id="web_search_arguments">
<tbody>
<tr>
<th>Parameters</th>
<th>Values/Description</th>
</tr>
<tr>
<td><code>:filter</code></td>
<td>
Filter out adult or hate content<br />
Syntax: <code>:filter => "-hate, -porn"</code>
</td>
</tr>
<tr>
<td><code>:type</code></td>
<td>Specifies document formats (pdf, msoffice,etc)</td>
</tr>
<tr>
<td>:view</td>
<td>Syntax: <code>:view => "view1,view2"</code>, etc</p>
<p><code>:view => "keyterms"</code> will retrieve related words and phrases for each search result.</p>
<p><code>:view => "searchmonkey_feed"</code> will retrieve structured data markup, if available, for the search result in dataRSS format.</p>
<p><code>:view => "searchmonkey_rdf"</code> will retrieve structured data markup, if available, for the search result in rdf format.</p>
<p><code>:view => "delicious_toptags"</code> will retrieve the top public delicious tags for a document and the counts associated with each tag</p>
<p><code>:view => "delicious_saves"</code> will retrieve the number of times a document was saved in delicious</p>
<p><code>:view => "language"</code> identifies the language of the document</p>
</td>
</tr>
<tr>
<td>:abstract</td>
<td><code>:abstract => "long"</code> will retrieve and display an abstract of a web document up to 300 characters. This expanded abstract provides the requestor with a larger piece of information to work from in a web search query. The default for abstract is an abbreviated description.</td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('web_response_fields')">here</a> to view list of response fields returned by web search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="web_response_fields" style="display:none">
<tbody>
<tr>
<th>Fields</th>
<th>Details</th>
</tr>
<tr>
<td><code>count</code></td>
<td>Indicates how many results to show per page. The value shown in results is the smaller of the default or explicit “count” request argument value or the actual number of results in the response. The result set will include the requested “count” unless there are fewer than that number of matching documents.</td>
</tr>
<tr>
<td><code>totalhits</code></td>
<td>A result count that reflects no duplicates. The totalhits value is an approximation, and its value may change depending on the requested “start” and “count” values, because the approximation is adjusted as more exact result URLs are processed. A normal use for totalhits is to determine how many pages of results to offer in search result navigation. Since totalhits is an approximation, and the value may change as “start” increases on successive result pages, the result page navigation may need to be adjusted as a user browses result pages.</td>
</tr>
<tr>
<td><code>deephits</code></td>
<td>It returns an approximate count that reflects duplicate documents and all documents from a host. deephits, therefore, is invariably equal to or larger than TotalHits. The deephits value is normally used as an information display on a search result page, reporting how many total documents matched the search terms.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Abstract with keywords highlighted with HTML tags. abstract=long  will retrieve and display an abstract of a web document up to 300 characters. This expanded abstract provides the requester with a larger piece of information to work from in a web search query. </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title with keywords highlighted with HTML tags</td>
</tr>
<tr>
<td><code>url</code></td>
<td>URL of result</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>Returns a navigation URL that leads to the target URL for each result. A clickurl might lead through a redirect server, which provides Yahoo! with important usage data from search result sets.</td>
</tr>
<tr>
<td><code>dispurl</code></td>
<td>Returns the URLs of documents matching the query result. Use this field only for display purposes on result pages. To direct search users to the target document, use the clickurl value</td>
</tr>
<tr>
<td><code>size</code></td>
<td>Returns the document’s size in bytes</td>
</tr>
<tr>
<td><code>date</code></td>
<td>Returns date in YYYY/MM/DD format</td>
</tr>
<tr>
<td><code>keyterms</code></td>
<td>When <code>:view => "keyterms"</code> is used in query string the keyterms section is included in the response. This includes a list of related words and phrases with the <code>term</code> subheadings.</td>
</tr>
<tr>
<td><code>searchmonkey_feed</code></td>
<td>Using this field will retrieve structured data markup, if available, for the search result in dataRSS format.</td>
</tr>
<tr>
<td><code>searchmonkey_rdf</code></td>
<td>Using this field will retrieve structured data markup, if available, for the search result in RDF format.</td>
</tr>
<tr>
<td><code>delicious_toptags</code></td>
<td>Retrieves the top public delicious tags for a document and the counts associated with each tag.</td>
</tr>
<tr>
<td><code>delicious_saves</code></td>
<td>The number of times a document was saved in delicious.</td>
</tr>
<tr>
<td><code>language</code></td>
<td>The language of the document.</td>
</tr>
</tbody>
</table>
<p><strong>Images Search</strong></p>
<p>For searching images on web, use the following code:</p>
<pre class="brush: ruby;">
boss = Search.images(&amp;quot;snow hills&amp;quot;, { :dimensions =&amp;gt; &amp;quot;large&amp;quot; })

boss.results.each do |result|
  puts &amp;quot;#{result.url}: #{result.abstract}&amp;quot;
end

# =&amp;gt; http://www.amanita-photolibrary.co.uk/photo_library/BI_habitats/gb96_chiltern_hills_from_ivinghoe_snow_std.jpg: Copyright © 2004 Chiltern hills east from near Ivinghoe snow habitats landscapes British Isles
</pre>
<p>Click <a href="javascript:toggleDiv('image_search_arguments')">here</a> for list of additional arguments that can be provided with image search. </p>
<table border="0" cellpadding="5" cellspacing="0" id="image_search_arguments" style="display:none">
<tbody>
<tr>
<th>Parameters</th>
<th>Values</th>
<th>Description</th>
</tr>
<tr>
<td><code>:filter</code></td>
<td><code>yes</code> (default) or <code>no</code></td>
<td>Whether or not to activate the Offensive Content Reduction filter. If set to yes, content marked as offensive is omitted from results.</td>
</tr>
<tr>
<td><code>:dimensions</code></td>
<td><code>all</code> (default), <code>small</code>, <code>medium</code>, <code>large</code>, <code>wallpaper</code>, <code>widewallpaper</code></td>
<td>Small images are generally thumbnail or icon sized. Medium sized images are average sized; usually not exceeding an average screen size. Large images are screen size or larger. Size pairs other than those listed are ignored.</td>
</tr>
<tr>
<td><code>:refererurl</code></td>
<td>URL, no default</td>
<td>
Search for this URL. Depending on other query restrictions, returns all image objects with this referring URL.</p>
<p>Example:  http://www.foo.com/~foo/images.htm
</td>
</tr>
<tr>
<td><code>:url</code></td>
<td>URL, no default</td>
<td>Search for this URL. Returns this exact image result.</p>
<p>Example: http://www.foo.com/~foo/images/mydog.gif
</td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('image_response_fields')">here</a> to view list of response fields returned by image search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="image_response_fields" style="display:none">
<tbody>
<tr>
<th>Field Name</th>
<th>Description</th>
</tr>
<tr>
<td><code>totalhits, deephits</code></td>
<td>Number of listings that match the query parameters.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Description of image</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>URL to click to view image </td>
</tr>
<tr>
<td><code>filename</code></td>
<td>Filename of image</td>
</tr>
<tr>
<td><code>size</code></td>
<td>Size of image file </td>
</tr>
<tr>
<td><code>format</code></td>
<td>Format of image </td>
</tr>
<tr>
<td><code>height</code></td>
<td>Height of full-size image </td>
</tr>
<tr>
<td><code>date</code></td>
<td>Last modification date of image YYYY/MM/DD</td>
</tr>
<tr>
<td><code>mimetype</code></td>
<td>MIME type of image </td>
</tr>
<tr>
<td><code>refererclickurl</code></td>
<td>Clickable link to page in which image was found </td>
</tr>
<tr>
<td><code>refererurl</code></td>
<td>Original link to page in which image was found </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title of image (usually the filename) </td>
</tr>
<tr>
<td><code>url</code></td>
<td>URL of image itself </td>
</tr>
<tr>
<td><code>width</code></td>
<td>Width of full-size image </td>
</tr>
<tr>
<td><code>thumbnail_url</code></td>
<td>Thumbnail image</td>
</tr>
<tr>
<td><code>thumbnail_height</code></td>
<td>Thumbnail height</td>
</tr>
<tr>
<td><code>thumbnail_width</code></td>
<td>Thumbnail width</td>
</tr>
</tbody>
</table>
<p><strong>News Search</strong></p>
<p>Yahoo! BOSS also provides news search capabilties. </p>
<pre class="brush: ruby;">
boss = BOSSMan::Search.news(&amp;quot;free shipping&amp;quot;, { :age =&amp;gt; &amp;quot;1d-2w&amp;quot;, :orderby =&amp;gt; &amp;quot;date&amp;quot;, :count =&amp;gt; 1})

boss.results.each do |result|
  puts &amp;quot;#{result.title} [from #{result.source}]&amp;quot;
  puts &amp;quot;#{result.abstract}&amp;quot;
end
# =&amp;gt; Wal-Mart announces weekly price cuts for holidays [from USA Today]
# =&amp;gt; Wal-Mart said it will cut prices this holiday season for a week at a time on thousands of items, from bananas to board games. The first group of cuts hit Wednesday.
</pre>
<p>Click <a href="javascript:toggleDiv('news_search_arguments')">here</a> for list of additional arguments that can be provided with news search. </p>
<table border="0" cellpadding="5" cellspacing="0" id="news_search_arguments" style="display:none">
<tbody>
<tr>
<th>Parameters</th>
<th>Values</th>
<th>Description</th>
</tr>
<tr>
<td><code>:age</code></td>
<td><code>7d</code></td>
<td>Use age= to retrieve documents by age:<br />
<code>:age => "[value]d"</code><br />
NOTE: Maximum [value] cannot be greater than 1000.<br />
The default is 30 days, and valid values are <code>[1-30]d</code>. (News Search maintains a 30-day index.) The following example searches the full index:<br />
<code>:age => "7d"</code><br />
Age can be specified using a string made an integer and one of the letters &#8220;<code>s</code>&#8220;, &#8220;<code>m</code>&#8220;, &#8220;<code>h</code>&#8220;, &#8220;<code>d</code>&#8221; and &#8220;<code>w</code>&#8221; representing seconds, minutes, hours, days and weeks.<br />
No spaces are allowed in the string. Some examples:<br />
<code>:age => "30d"</code><br />
<code>:age => "1w"</code><br />
<code>:age => "12h"</code><br />
To specify an age range two values can be concatenated with a dash/hyphen for example:<br />
<code>:age => "5d-10d"</code> Between 5 and 10 days old<br />
<code>:age => "2w-30d"</code> Between 2 weeks and 30 days old<br />
Multiple ranges or more than one age parameter is not supported. </td>
</tr>
<tr>
<td><code>:orderby</code></td>
<td>relevance</td>
<td>To order by date add <code>:orderby => "date"</code> to the query string. Results will be returned with the most recent first. </td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('news_response_fields')">here</a> to view list of response fields returned by news search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="news_response_fields" style="display:none">
<tbody>
<tr>
<th>Field Name</th>
<th>Description</th>
</tr>
<tr>
<td><code>totalhits, deephits</code></td>
<td>Number of listings that match the query parameters.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Abstract of news story.</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>Click this link to reach story, if present. </td>
</tr>
<tr>
<td><code>language</code></td>
<td>Language of story. </td>
</tr>
<tr>
<td><code>date</code></td>
<td>Last publication date of story. </td>
</tr>
<tr>
<td><code>time</code></td>
<td>Last publication time of story.</td>
</tr>
<tr>
<td><code>source</code></td>
<td>Source publication. </td>
</tr>
<tr>
<td><code>sourceurl</code></td>
<td>URL of source publication. </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title (or Headline) of the story. </td>
</tr>
<tr>
<td><code>url</code></td>
<td>Link to story.</td>
</tr>
</tbody>
</table>
<p><strong>Spelling Search</strong></p>
<p>Correct your misspelled words using its spelling suggestion feature:</p>
<pre class="brush: ruby;">
boss = BOSSMan::Search.spelling(&amp;quot;acknowlegment&amp;quot;)
puts boss.suggestion # =&amp;gt; acknowledgment
</pre>
<p><strong>Site Explorer</strong></p>
<p>You can also search for the pages from other sites linking into your site pages.</p>
<pre class="brush: ruby;">
links = Search.se_inlink(&amp;quot;http://mail.yahoo.com&amp;quot;, :count =&amp;gt; 2)
links.results.map { |result| p result.url }
# =&amp;gt; http://www.aol.com/
# =&amp;gt; http://groups.yahoo.com/
</pre>
<p>For displays a list of all pages belonging to a domain in the Yahoo! index, use se_pagedata method provided.</p>
<pre class="brush: ruby;">
links = Search.se_pagedata(&amp;quot;twitter.com&amp;quot;, :count =&amp;gt; 1)
links.results.map { |result| p &amp;quot;#{result.url} - #{result.abstract}&amp;quot; }
# =&amp;gt; http://twitter.com/ - Use Twitter to send status updates (tweets) through your cell phone, instant messenger, or via the Web, and notify friends and followers of the little things &amp;lt;b&amp;gt;...&amp;lt;/b&amp;gt;
</pre>
<p><strong>Universal Arguments for Web, Images and News</strong></p>
<p>Following is the list of most commonly used arguments with web, image and news search. For more comprehensive list click <a href="http://developer.yahoo.com/search/boss/boss_guide/overview.html">here</a></p>
<table border="0" cellpadding="5" cellspacing="0" id="universal_arguments">
<tbody>
<tr>
<th>Argument</th>
<th>Options/Details</th>
</tr>
<tr>
<td><code>:start</code></td>
<td>Ordinal position of first result. First position is 0. Default sets start to 0.</td>
</tr>
<tr>
<td><code>:count</code></td>
<td>Total number of results to return. Maximum value is 50. Default sets count to 10.</td>
</tr>
<tr>
<td><code>:format</code></td>
<td>The data format of the response. Value can be set to either <code>"xml"</code> or <code>"json"</code>. Default sets format to <code>"json"</code>.</td>
</tr>
<tr>
<td><code>:callback</code></td>
<td>The name of the callback function to wrap the result. Parameter is valid only if format is set to <code>"json"</code>. No default value exists.</td>
</tr>
<tr>
<td><code>:sites</code></td>
<td>Restrict BOSS search results to a set of pre-defined sites. Multiple sites must be comma separated. Example: (<code>:sites => "abc.com,cnn.com"</code>). The Images service does not yet support multiple sites.</td>
</tr>
<tr>
<td><code>:view</code></td>
<td>Retrieve additional search data provided by the respective BOSS service. Please see individual chapters to see what view options are available.</td>
</tr>
<tr>
<td><code>:style</code></td>
<td>By default for web search result titles and abstracts contain bold HTML tags around the search term. Use <code>:style => "raw"</code> to remove the bold tags around the search terms in titles and abstracts.</td>
</tr>
</tbody>
</table>


<p>Related posts:<ol><li><a href='http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/' rel='bookmark' title='Permanent Link: Ruby on Rails Caching And JavaScript Techniques'>Ruby on Rails Caching And JavaScript Techniques</a> <small>Cross posted from darthsid While implementing caching in a recent...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Caching And JavaScript Techniques</title>
		<link>http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/</link>
		<comments>http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 06:47:20 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=704</guid>
		<description><![CDATA[Cross posted from darthsid
While implementing caching in a recent rails project I came across some typical caching issues. In a lot of pages the content is same for all users but certain components in them have user specific actions. As an example, I have a page listing all public messages that users have posted(similar to [...]


Related posts:<ol><li><a href='http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/' rel='bookmark' title='Permanent Link: Jquery Full Calendar with Ruby on Rails'>Jquery Full Calendar with Ruby on Rails</a> <small>Contrary to popular belief, working on a client project gives...</small></li>
<li><a href='http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/' rel='bookmark' title='Permanent Link: Integrating Yahoo! BOSS with your ruby on rails application'>Integrating Yahoo! BOSS with your ruby on rails application</a> <small>What is Yahoo! BOSS? Yahoo developer website cites it as:...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Cross posted from <a title="Sid's Blog" href="http://darthsid.com/blog">darthsid</a></p>
<p>While implementing caching in a recent rails project I came across some typical caching issues. In a lot of pages the content is same for all users but certain components in them have user specific actions. As an example, I have a page listing all public messages that users have posted(similar to the <a href="http://twitter.com/public_timeline">public timeline</a> in <a href="http://twitter.com">twitter</a>) but actions on those messages are user specific(eg: only owner or admin can delete a message). Also, most of these actions use ajax and the rails <a href="http://ryandaigle.com/articles/2007/9/24/what-s-new-in-edge-rails-better-cross-site-request-forging-prevention">authenticity token</a> in them also gets cached resulting in subsequent failures if the session changes. Another issue was that the timestamps in most pages is fuzzy and they become irrelevant if a page gets cached for too long. I could have created separate caches for each user but if the user base really grows managing the caches would become a nightmare and that would still not solve the authenticity token and the timestamp problem. The simplest solution was to use JavaScript, more specifically <a href="http://jquery.com">jQuery</a>.<br />
<span id="more-704"></span><br />
I have been a big fan of jQuery since I started using it about a year and a half ago and try to use it in all my projects. There is an excellent Rails plugin called <a href="http://ennerchi.com/projects/jrails">jRails</a> that replaces Prototype with jQuery and provides all the default Rails helpers for JavaScript making jQuery even more tempting to use. The examples I use below all use jQuery.</p>
<p><big><big><strong>1. Handling User Specific Components</strong></big></big></p>
<p>Taking the delete action as explained in the example above, the code in the cached view looks something like this:</p>
<pre class="brush: ruby;">
&amp;lt;% if logged_in? %&amp;gt;
&amp;lt;li class=&amp;quot;delete &amp;lt;%= 'only_' + (message.owner.login) + '_delete_allowed' %&amp;gt;&amp;quot;&amp;gt;
  &amp;lt;%= link_to_remote &amp;quot;Delete&amp;quot;,
    :url =&amp;gt; user_message_path(current_user, message)
    :method =&amp;gt; :delete,
    :confirm =&amp;gt; &amp;quot;Are you sure you wish to delete this message?&amp;quot;,
    :html =&amp;gt; { :title =&amp;gt; &amp;quot;Delete Post&amp;quot; } %&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;% end %&amp;gt;
</pre>
<p>This will create an li element with class &#8220;delete&#8221; and &#8220;only_kratos_delete_allowed&#8221; if the username of the message owner is &#8220;kratos&#8221;</p>
<p>In the non-cached part of the view I have the following code:</p>
<pre class="brush: ruby;">
&amp;lt;% if logged_in? %&amp;gt;
  &amp;lt;% if current_user.is_admin? %&amp;gt;
    &amp;lt;%= javascript_tag &amp;quot;$(document).ready(function() { MessageView.removeInvalidDeteteButtons('only_#{current_user.login}_delete_allowed', 'true'); });&amp;quot; %&amp;gt;
  &amp;lt;% else %&amp;gt;
    &amp;lt;%= javascript_tag &amp;quot;$(document).ready(function() { MessageView.removeInvalidDeteteButtons('only_#{current_user.login}_delete_allowed'); });&amp;quot; %&amp;gt;
  &amp;lt;% end %&amp;gt;
&amp;lt;% end %&amp;gt;
</pre>
<p>If the current user is an admin I pass the JavaScript function an additional parameter.</p>
<p>In the application.js file I have the following code:</p>
<pre class="brush: jscript;">
var MessageView = {
  removeInvalidDeteteButtons: function(element_class, admin) {
    if (admin == undefined)
    {
      $('.delete').each(function() { if (!$(this).hasClass(element_class)) { $(this).remove(); } });
    }
  }
}
</pre>
<p>If the second parameter is passed(in the case of an admin) the function does nothing, else it iterates over all li elements with class &#8220;delete&#8221; and removes all elements that do not also have, in this case, the &#8220;only_kratos_delete_allowed&#8221; class.</p>
<p><big><big><strong>2. Handling Rails Authenticity Token</strong></big></big></p>
<p>This part describes how to take care of the authenticity token problem:</p>
<p>I added the following code to the layout:</p>
<pre class="brush: ruby;">
&amp;lt;%= javascript_tag &amp;quot;var AUTH_TOKEN = #{form_authenticity_token.inspect};&amp;quot; if protect_against_forgery? %&amp;gt;
</pre>
<p>This code creates a JavaScript variable named &#8220;AUTH_TOKEN&#8221; that contains the current authentication token. Since this section is not cached it always get the correct token.</p>
<p>Next I added the following code to application.js:</p>
<pre class="brush: jscript;">
$(document).ajaxSend(function(event, request, settings) {
  if (settings.type == 'get' || settings.type == 'GET' || typeof(AUTH_TOKEN) == &amp;quot;undefined&amp;quot;) return;
  var authTokenRegExp = /authenticity_token=\w{40}/
  settings.data = settings.data || &amp;quot;&amp;quot;;
  if (authTokenRegExp.test(settings.data))
  {
    settings.data=settings.data.replace(authTokenRegExp, &amp;quot;authenticity_token=&amp;quot; + encodeURIComponent(AUTH_TOKEN));
  }
  else
  {
    settings.data += (settings.data ? &amp;quot;&amp;amp;&amp;quot; : &amp;quot;&amp;quot;) + &amp;quot;authenticity_token=&amp;quot; + encodeURIComponent(AUTH_TOKEN);
  }
})
</pre>
<p>This code is a slight modification of the code posted <a href="http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery">here</a>. <a href="http://docs.jquery.com/Ajax/ajaxSend">ajaxSend</a> is jQuery function that is executed before every ajax request is sent and I use it here to replace or append the authenticity token to the request, unless the request is GET or the AUTH_TOKEN variable is not defined.</p>
<p><big><big><strong>3. Handling Fuzzy Timestamps</strong></big></big></p>
<p>The code for timestamps in the cached view looks like this:</p>
<pre class="brush: ruby;">
&amp;lt;span&amp;gt;
  &amp;lt;%= process_message_body_timestamp(message) %&amp;gt;
&amp;lt;/span&amp;gt;
</pre>
<p>And the helper code is:</p>
<pre class="brush: ruby;">
def process_message_body_timestamp(message)
  link_to &amp;quot;#{message.created_at}&amp;quot;, show_message_url(message), :class =&amp;gt; &amp;quot;timestamps&amp;quot;
end
</pre>
<p>I put the following code in the layout(non-cached):</p>
<pre class="brush: ruby;">
&amp;lt;%= javascript_tag &amp;quot;$(document).ready(function() { CustomDate.datify(#{get_custom_date_arguments}) });&amp;quot; %&amp;gt;
</pre>
<p>The get_custom_date_arguments helper is defined in application helper and returns a string containing the current time arguments needed for the JavaScript function:</p>
<pre class="brush: ruby;">
def get_custom_date_arguments
  current_time = Time.zone.now
  &amp;quot;#{current_time.year},#{current_time.month-1},#{current_time.day},#{current_time.hour},#{current_time.min},#{current_time.sec}&amp;quot;
end
</pre>
<p>I put the following code in application.js:</p>
<pre class="brush: jscript;">
var CustomDate = {
  datify: function(current_utc_year,
                   current_utc_month,
                   current_utc_day,
                   current_utc_hour,
                   current_utc_minute,
                   current_utc_second) {
    $('.timestamps').each(function() {
      $(this).html(CustomDate.humane_date($(this).html(),
                                          current_utc_year,
                                          current_utc_month,
                                          current_utc_day,
                                          current_utc_hour,
                                          current_utc_minute,
                                          current_utc_second)).removeClass('timestamps')
    })
  },

  humane_date: function(date_str, current_utc_year, current_utc_month, current_utc_day, current_utc_hour, current_utc_minute, current_utc_second) {
    var time_formats = [
                        [60, 'less than a minute ago'],
                        [90, '1 minute'], // 60*1.5
                        [3600, 'minutes', 60], // 60*60, 60
                        [5400, '1 hour'], // 60*60*1.5
                        [86400, 'hours', 3600], // 60*60*24, 60*60
                        [129600, '1 day'], // 60*60*24*1.5
                        [604800, 'days', 86400], // 60*60*24*7, 60*60*24
                        [907200, '1 week'], // 60*60*24*7*1.5
                        [2628000, 'weeks', 604800], // 60*60*24*(365/12), 60*60*24*7
                        [3942000, '1 month'], // 60*60*24*(365/12)*1.5
                        [31536000, 'months', 2628000], // 60*60*24*365, 60*60*24*(365/12)
                        [47304000, '1 year'], // 60*60*24*365*1.5
                        [3153600000, 'years', 31536000], // 60*60*24*365*100, 60*60*24*365
                        [4730400000, '1 century'], // 60*60*24*365*100*1.5
                      ];

    var time = ('' + date_str).replace(/-/g,&amp;quot;/&amp;quot;).replace(/[TUTC]/g,&amp;quot; &amp;quot;),
        dt = new Date

    dt.setUTCFullYear(current_utc_year, current_utc_month, current_utc_day)
    dt.setUTCHours(current_utc_hour, current_utc_minute, current_utc_second)

    var seconds = ((dt - new Date(time) + (dt.getTimezoneOffset() * 60000)) / 1000),
        token = ' ago',
        prepend = '',
        i = 0,
        format;

    if (seconds &amp;lt; 0) {
      seconds = Math.abs(seconds);
      token = '';
      prepend = 'in ';
    }

    while (format = time_formats[i++]) {
      if (seconds &amp;lt; format[0]) {
        if (format.length == 2) {
          return (i&amp;gt;1?prepend:'') + format[1] + (i &amp;gt; 1 ? token : ''); // Conditional so we don't return Just Now Ago
        }
        else {
            return prepend + Math.round(seconds / format[2]) + ' ' + format[1] + (i &amp;gt; 1 ? token : '');
        }
      }
    }

    // overflow for centuries
    if(seconds &amp;gt; 4730400000) {
      return Math.round(seconds / 4730400000) + ' Centuries' + token;
    }

    return date_str;
  }
}
</pre>
<p>The datify function iterates over all timestamps(elements with class &#8220;timestamps&#8221;) and replaces them with fuzzy timestamps. The humane_date function(yanked from <a href="http://stackoverflow.com/questions/168924/how-to-render-contextual-difference-between-two-timestamps-in-javascript">here</a>) generates the actual fuzzy timestamps.</p>


<p>Related posts:<ol><li><a href='http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/' rel='bookmark' title='Permanent Link: Jquery Full Calendar with Ruby on Rails'>Jquery Full Calendar with Ruby on Rails</a> <small>Contrary to popular belief, working on a client project gives...</small></li>
<li><a href='http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/' rel='bookmark' title='Permanent Link: Integrating Yahoo! BOSS with your ruby on rails application'>Integrating Yahoo! BOSS with your ruby on rails application</a> <small>What is Yahoo! BOSS? Yahoo developer website cites it as:...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/09/07/rails-caching-and-javascript-techniques/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Integrate TinyMce with Redbox in 5 steps ?</title>
		<link>http://vinsol.com/blog/2009/09/04/how-to-integrate-tinymce-with-redbox-in-5-steps/</link>
		<comments>http://vinsol.com/blog/2009/09/04/how-to-integrate-tinymce-with-redbox-in-5-steps/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 01:53:12 +0000</pubDate>
		<dc:creator>payal</dc:creator>
				<category><![CDATA[tinymce]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[popup and tinymce]]></category>
		<category><![CDATA[redbox]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=716</guid>
		<description><![CDATA[TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control.  It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.
Redbox is a library that pops a modal box over a web page, using CSS and javascript, so that you can ask the user a question, or [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control.  It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
<p>Redbox is a library that pops a modal box over a web page, using CSS and javascript, so that you can ask the user a question, or show them something important. The box can be loaded from content already on the page (but hidden), or it can be loaded via AJAX. The contents of the box can be replaced using AJAX, for multi-page forms, and it can be closed easily using a javascript link.</p>
<p>Here is the process for integrating Redbox and tinymce.</p>
<p><strong>Step I:</strong><br />
Install required plugins:</p>
<p>- TinyMce(<a href="http://github.com/kete/tiny_mce/tree/master">http://github.com/kete/tiny_mce/tree/master</a>)<br />
- RedBox(<a href="http://www.craigambrose.com/projects/redbox">http://www.craigambrose.com/projects/redbox</a>)</p>
<p><strong>Step II:</strong><br />
Include javascript files to layout:</p>
<pre class="brush: ruby;">
  &lt;%= include_tiny_mce_js %&gt;
  &lt;%= javascript_tag &quot;initialize_editor();&quot; %&gt;
</pre>
<p>Now, add this javascript method which initilizes the text editor. You can specify the options you want for your text editor here.</p>
<p>Javascript:</p>
<pre class="brush: ruby;">function  initialize_editor(){
  tinyMCE.init({
    theme:&quot;advanced&quot;,
    //mode:&quot;textareas&quot;, // this is commented because we do not want to apply the editor to all the text area
     instances. Instead, we will use the class &quot;mceEditor&quot; to specify on which element we want to add the editor.
    theme_advanced_toolbar_location:&quot;top&quot;,
    theme_advanced_toolbar_align:&quot;left&quot;,
    theme_advanced_resizing:true,
    theme_advanced_resize_horizontal:false,
    paste_auto_cleanup_on_paste:true,
theme_advanced_blockformats:&quot;p,address,pre,h1,h2,h3,h4,h5,h6&quot;,
    theme_advanced_buttons1:&quot;bold, italic, underline, strikethrough, | , undo, redo, link, unlink, image, | , bullist, numlist&quot;,
    theme_advanced_buttons2:&quot;&quot;,
    theme_advanced_buttons3:&quot;&quot;,
    dialog_type:&quot;modal&quot;
  });
}</pre>
<p><strong><br />
Step III:</strong></p>
<p><strong><br />
</strong></p>
<p>Add editor class &#8220;mceEditor&#8221; to the text area where you want the editor to be added.</p>
<pre class="brush: ruby;">&lt;%= f.text_area :details, :id =&gt; 'ta_id', :class =&gt; 'mceEditor' %&gt;</pre>
<p>Now, we need to create a tinymce editor control for the text area(&#8216;ta_id&#8217;) on loading the popup so add this &#8220;execCommand&#8221; loads the tinyMCE in the textarea.</p>
<pre class="brush: ruby;">&lt;script type=&quot;text\javascript&quot;&gt;
  tinyMCE.execCommand('mceAddControl', true, &quot;ta_id&quot;);
&lt;/script&gt;</pre>
<p><strong>Step IV:</strong></p>
<p><strong><br />
</strong></p>
<p>When we submit our form and copy over the editor content to the text box it references. Tinymce provides a method &#8216;triggerSave&#8217; that moves the contents from the editor to the form field. This method is automatically called by tinyMCE by adding a trigger on the forms submit method.</p>
<p>Save the content:</p>
<pre class="brush: ruby;">&lt;%= f.submit 'Save', :class =&gt; 'primaryAction', :onclick =&gt; &quot;tinyMCE.triggerSave(true,true);&quot; %&gt;</pre>
<p><strong>Step V:</strong></p>
<p><strong><br />
</strong></p>
<p>Whenever we close our popup redbox we need to remove the tinymce editor control that we had added. Remove control on closing the redbox:</p>
<pre class="brush: ruby;">&lt;%= link_to_close_redbox 'Close', {:onclick =&gt; &quot;tinyMCE.execCommand('mceRemoveControl', true, 'ta_id'});&quot;} %&gt;</pre>
<p>Works on: Firefox(1.5+), Safari and IE(7+)</p>
<p>For Internet Explorer  we need to initialize the editor on loading the pop-up but for firefox we need to initalize editor on loading the main page. So we need modify our javascript</p>
<pre class="brush: ruby;">&lt;script type=&quot;text\javascript&quot;&gt;
  if(navigator.appName==&quot;Microsoft Internet Explorer&quot;)
  	initialize_editor();
  tinyMCE.execCommand('mceAddControl', true, &quot;ta_id&quot;);
&lt;/script&gt;</pre>
<p>And so here we are ready to go in just five simple steps.</p>
<p>Refer <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Functions">here </a>for more details.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/09/04/how-to-integrate-tinymce-with-redbox-in-5-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
