<?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>Starqle Indonesia</title>
	<atom:link href="http://starqle.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://starqle.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 11 Aug 2011 02:32:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>We are hiring!</title>
		<link>http://starqle.com/news/we-are-hiring/</link>
		<comments>http://starqle.com/news/we-are-hiring/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 06:08:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=402</guid>
		<description><![CDATA[We are glad to announce that we are looking for more people to add to the team. We are looking for young and enthusiastic people who love to create and tinker with web based application. Specifically, we are looking for candidates with qualifications: Bachelor degree, fresh graduates are very welcome Have a good understanding of web programming, be it PHP, <a href="http://starqle.com/news/we-are-hiring/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>We are glad to announce that we are looking for more people to add to the team. We are looking for young and enthusiastic people who <strong>love to create and tinker with web based application</strong>. Specifically, we are looking for candidates with qualifications:</p>
<ol>
<li><strong>Bachelor degree</strong>, fresh graduates are very welcome</li>
<li>Have a good understanding of <strong>web programming</strong>, be it PHP, JSP, or Ruby on Rails</li>
<li>Have a good understanding of <strong>object oriented programming</strong>, understanding of MVC framework will be great advantage</li>
<li>Team player and fast learner</li>
<li>Willing to be located in Bandung</li>
</ol>
<p>Send your CV to info@starqle.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/news/we-are-hiring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Express &#124; A Premium Free Theme</title>
		<link>http://starqle.com/articles/express-a-premium-free-theme/</link>
		<comments>http://starqle.com/articles/express-a-premium-free-theme/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 09:13:17 +0000</pubDate>
		<dc:creator>reyhanypohan</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Premium]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=377</guid>
		<description><![CDATA[Express is a premium free theme from Expressima, one of Starqle&#8217;s products. This is a professional/business/portfolio theme that showcases your business products or services, company info, latest news, etc.  It&#8217;s perfect for freelancers, startups or small business. Express comes with an awesome carousel on the homepage for featured stuffs, fully working contact forms, and custom post types. Works with Firefox <a href="http://starqle.com/articles/express-a-premium-free-theme/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Express is a premium free theme from <a href="http://expressima.com">Expressima</a>, one of Starqle&#8217;s products. This is a professional/business/portfolio theme that showcases your business products or services, company info, latest news, etc.  It&#8217;s perfect for freelancers, startups or small business.</p>
<p>Express comes with an awesome carousel on the homepage for featured stuffs, fully working contact forms, and custom post types. Works with Firefox 3+ and Chrome 10+.</p>
<p><a href="http://expressima.com/demo/" target="blank">Demo</a> || <a href="http://starqle.com/wp-content/uploads/2011/express.zip">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/express-a-premium-free-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tumblr-like back-to-top Using jQuery.scrollTop()</title>
		<link>http://starqle.com/articles/tumblr-like-back-to-top-using-jquery-scrolltop/</link>
		<comments>http://starqle.com/articles/tumblr-like-back-to-top-using-jquery-scrolltop/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 06:30:32 +0000</pubDate>
		<dc:creator>raymondralibi</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=363</guid>
		<description><![CDATA[Have you ever seen back-to-top button on tumblr dashboard? Try scrolling the page. Back-to-top button will appear on top-right of the page after the scroll has reached about 1000px from top. See the demo In this article I’m going to show you how to do it. First of all download the latest jquery and include it in your page. Create <a href="http://starqle.com/articles/tumblr-like-back-to-top-using-jquery-scrolltop/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Have you ever seen back-to-top button on tumblr dashboard? Try scrolling the page. Back-to-top button will appear on top-right of the page after the scroll has reached about 1000px from top.</p>
<p>See the <a title="Tumblr-like back-to-top Demo" href="http://ralibi.com/demo/tumblr-like-demo-note-top-right-of-the-page/">demo</a></p>
<p><a class="image_link" href="http://ralibi.com/wp-content/uploads/2011/03/tumblr-like.png"><img class="alignnone size-full wp-image-22" title="tumblr like" src="http://ralibi.com/wp-content/uploads/2011/03/tumblr-like.png" alt="" width="500" height="181" /></a></p>
<p>In this article I’m going to show you how to do it. First of all download the latest <a href="http://jquery.com/">jquery</a> and include it in your page.</p>
<p>Create link to top of page or just link to &#8216;#&#8217;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;back_to_top&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Back to top&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;your-back-to-top-image.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Back to Top&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p>Give back-to-top link some style</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#back-to-</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
  opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Put this script into your javascript file</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
  jQuery<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// if you want to measure 1000px from the top, use --&amp;gt; if(jQuery(window).scrollTop() &amp;gt; 1000)</span>
    <span style="color: #006600; font-style: italic;">// if you want to measure 1000px from the bottom, use  --&amp;gt; if(jQuery(document).height() - jQuery(window).height() - jQuery(window).scrollTop() &amp;lt; 1000)</span>
    <span style="color: #006600; font-style: italic;">// check whether the scroll has reached 1000px from the top</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// show back to top</span>
      jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#back-to-top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// hide back to top</span>
      jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#back-to-top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That&#8217;s all, enjoy your back-to-top link. See the <a title="Tumblr-like back-to-top Demo" href="http://ralibi.com/demo/tumblr-like-demo-note-top-right-of-the-page/">demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/tumblr-like-back-to-top-using-jquery-scrolltop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sexy CSS3 Buttons</title>
		<link>http://starqle.com/articles/sexy-css3-buttons/</link>
		<comments>http://starqle.com/articles/sexy-css3-buttons/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 03:48:16 +0000</pubDate>
		<dc:creator>tarabaskara</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Button]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=336</guid>
		<description><![CDATA[Creating buttons using a CSS3-based method becomes easier. I read a great tutorial at ZURB who made super awesome CSS3 buttons. I have taken their example and tweaked a bit to make this tutorial. The Button This is the main structure of my button set. It made by a border, border-radius, box-shadow, and text-shadow. Here’s the CSS code: .button&#123; &#160; <a href="http://starqle.com/articles/sexy-css3-buttons/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Creating buttons using a CSS3-based method becomes easier. I read a great tutorial at <a title="ZURB" href="http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba" target="_blank">ZURB</a> who made super awesome CSS3 buttons. I have taken their example and tweaked a bit to make this tutorial.</p>
<p><strong>The Button</strong><br />
This is the main structure of my button set. It made by a border, border-radius, box-shadow, and text-shadow. Here’s the CSS code:</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.button<span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">6px</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Helvetica<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1px</span> <span style="color: #933;">3px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1px</span> <span style="color: #933;">3px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1px</span> <span style="color: #933;">3px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">-1px</span> <span style="color: #933;">1px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<p>&nbsp;</p>
<p><strong>The Sizes</strong><br />
After we made the .button class, we can setup some instances of size. In this tutorial I have set the classes .small, .medium, and .large.</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #993333;">large</span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">24px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
.<span style="color: #993333;">medium</span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
.small<span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<p>&nbsp;</p>
<p><strong>The Colors</strong><br />
The final step is to add some colors.</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #993333;">red</span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#FF0012</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#E50010</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#FF0012</span><span style="color: #00AA00;">,</span> &nbsp;<span style="color: #cc00cc;">#E50010</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
.<span style="color: #993333;">red</span><span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#E50010</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#BC000D</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#E50010</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#BC000D</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<p>&nbsp;</p>
<p>And there you have it. A sexy button using CSS3-based method. You can download the final coded example <a title="Sexy CSS3 Buttons" href="http://starqle.com/wp-content/uploads/2011/Sexy%20Button.zip" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/sexy-css3-buttons/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bandung Ventures Night 2011</title>
		<link>http://starqle.com/news/bandung-ventures-night-2011/</link>
		<comments>http://starqle.com/news/bandung-ventures-night-2011/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 06:33:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=321</guid>
		<description><![CDATA[As a member of IF Association, we at Starqle are glad to announce that IF Association will be supporting East Ventures to hold Bandung Ventures Night 2011. Bandung Ventures Night is an event for local start ups that run their business in consumer web or mobile applications to pitch their business idea in front of potential investors. East Ventures is a <a href="http://starqle.com/news/bandung-ventures-night-2011/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>As a member of IF Association, we at Starqle are glad to announce that IF Association will be supporting East Ventures to hold Bandung Ventures Night 2011. Bandung Ventures Night is an event for local start ups that run their business in consumer web or mobile applications to pitch their business idea in front of potential investors.</p>
<p>East Ventures is a venture capital company based in Singapore. East Ventures has now conducted a series of ventures night like Jakarta Ventures Night 2010, Bandung Ventures Night 2010, and Jakarta Ventures Night 2011. East Ventures has given investment to a number of successful local start ups in Indonesia.</p>
<p>IF Association is a community of IT start ups whose founders are graduates from Informatics Engineering of Institut Teknologi Bandung. The community focuses on helping each others to grow as companies by sharing knowledges and experiences of a company to others.</p>
<p>This edition of Bandung Ventures Night is particularly a special opportunity for ITB community. Bandung Ventures Night 2011 is aimed for students and alumni of ITB who run a start up or have business ideas in consumer web and mobile application field.</p>
<p>If you happen to be an ITB student or almuni and interested to pitch your idea, you can send your business plan and curriculum vitae of the founders of your business to <a href="mailto:bvn@east.vc">bvn@east.vc</a> before Monday, April 4, 2011 at 5pm. Up to 10 selected start ups will be given a chance to pitch their ideas in Friday, April 8, 2011. If East Ventures like the idea you pitch, it is a good chance they will give seed investment for your start up.</p>
<p>So, don&#8217;t miss out this great opportunity to get potential investment and let your start up be covered by the media!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/news/bandung-ventures-night-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend + NicEdit</title>
		<link>http://starqle.com/articles/zend-nicedit/</link>
		<comments>http://starqle.com/articles/zend-nicedit/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 06:53:57 +0000</pubDate>
		<dc:creator>reyhanypohan</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[NicEdit]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=186</guid>
		<description><![CDATA[In one my projects, I had to change a html textarea into an editor where you can decorate the text bold, italic,underlined, etc just like you could composing an email. I had trouble finding the term for this kind of editor but I finally found it, it is a WYSIWYG editor. Googling &#8220;javascript editor&#8221; was a dumb thing to do. After <a href="http://starqle.com/articles/zend-nicedit/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>In one my projects, I had to change a html textarea into an editor where you can decorate the text bold, italic,underlined, etc just like you could composing an email. I had trouble finding the term for this kind of editor but I finally found it, it is a WYSIWYG editor. Googling &#8220;javascript editor&#8221; was a dumb thing to do.</p>
<p>After seconds searching for WYSIWYG editor codes, I stumbled upon 2 platforms, TinyMCE and NicEdit. For the project, I used Zend Framework so I googled on how to integrate those 2 platforms with Zend Framework. The first result that came up was <a href="http://www.codersarmy.com/zend-tinymce">Zend + TinyMCE</a>, an all detailed tutorial I had hoped for. Turns out this was not my luck as I followed all the steps but the form didn&#8217;t show at all on my view file. So I changed my focus on NicEdit. There was not a lot of documentation on how to implement the codes, especially integrating it Zend. But I downloaded the files and looked at the examples. It was A LOT easier than TinyMCE. Here&#8217;s how you integrate Zend with NicEdit:</p>
<p>1. The first thing you should do is, of course, download the file <a href="http://nicedit.com/download.php">here</a>.</p>
<p>2. Extract it and copy the file nicEdit.js and nicEditorIcons.gif to your /public/js. Don&#8217;t forget to edit the iconsPath (line 31) in the nicEdit.js.</p>
<p>3. Include nicEdit.js to your layout.phtml</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php echo <span style="color: #006699; font-weight: bold;">$this</span>-&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">// &lt;![CDATA[</span><br />
baseUrl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'js/nicEdit.js'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #0000ff;">&quot;&gt;<br />
// ]]&gt;&lt;/script&gt;</span></div></div>
<p>4. And still in your layout.phtml, add one of these below codes. These codes will change your &lt;textarea&gt; html tag with the NicEdit editor. You could change all the &lt;textarea&gt; html tags or a specific one by including the &lt;textarea&gt; id.</p>
<p>Code to change all textareas:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php echo <span style="color: #006699; font-weight: bold;">$this</span>-&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">// &lt;![CDATA[</span><br />
baseUrl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'js/nicEdit.js'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #0000ff;">&quot;&gt;<br />
// ]]&gt;&lt;/script&gt;<br />
&lt;script type=&quot;</span>text<span style="color: #339933;">/</span>javascript<span style="color: #0000ff;">&quot;&gt;// &lt;![CDATA[<br />
&nbsp; &nbsp; &nbsp; &nbsp; bkLib.onDomLoaded(function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nicEditors.allTextAreas();<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
<br />
// ]]&gt;&lt;/script&gt;</span></div></div>
<p>Code to change a specific textarea:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php echo <span style="color: #006699; font-weight: bold;">$this</span>-&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">// &lt;![CDATA[</span><br />
baseUrl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'js/nicEdit.js'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #0000ff;">&quot;&gt;<br />
// ]]&gt;&lt;/script&gt;<br />
&lt;script type=&quot;</span>text<span style="color: #339933;">/</span>javascript<span style="color: #0000ff;">&quot;&gt;// &lt;![CDATA[<br />
&nbsp; &nbsp; &nbsp; &nbsp; bkLib.onDomLoaded(function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new nicEditor().panelInstance('id');<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
<br />
// ]]&gt;&lt;/script&gt;</span></div></div>
<p>5. You could also change the configuration of the editor. For example, you just want the bold-italic-underline buttons. For the complete configuration see <a href="http://wiki.nicedit.com/w/page/515/Configuration-Options">here</a>.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php echo <span style="color: #006699; font-weight: bold;">$this</span>-&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">// &lt;![CDATA[</span><br />
baseUrl<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'js/nicEdit.js'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #0000ff;">&quot;&gt;<br />
// ]]&gt;&lt;/script&gt;<br />
&lt;script type=&quot;</span>text<span style="color: #339933;">/</span>javascript<span style="color: #0000ff;">&quot;&gt;// &lt;![CDATA[<br />
&nbsp; &nbsp; &nbsp; &nbsp; bkLib.onDomLoaded(function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new nicEditor({buttonList : ['bold','italic','underline']}).panelInstance('id');<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
<br />
// ]]&gt;&lt;/script&gt;</span></div></div>
<p>6. Go on to the browser and we&#8217;re done! All of those Zend_Form_Element_Textarea will be changed to NicEdit editor! Basically if you still can&#8217;t get it right, you should look at the examples. They&#8217;re very easy to learn from. I hope this could help you who are looking for a WYSIWYG for Zend!</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/zend-nicedit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Photoshop Tutorial &#8211; Bleach Bypass</title>
		<link>http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/</link>
		<comments>http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 04:40:49 +0000</pubDate>
		<dc:creator>tarabaskara</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Adobe Photoshop]]></category>
		<category><![CDATA[Bleach Bypass]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=131</guid>
		<description><![CDATA[Have you ever seen Se7en, Saving Private Ryan, or Batman Begins? Do you know the similarity of these films? Maybe not everyone knows that these three films using the same technique commonly called Bleach bypass. From wikipedia Bleach bypass, also known as skip bleach or silver retention, is an optical effect which entails either the partial or complete skipping of <a href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>Have you ever seen Se7en, Saving Private Ryan, or Batman Begins? Do you know the similarity of these films? Maybe not everyone knows that these three films using the same technique commonly called Bleach bypass. From wikipedia Bleach bypass, also known as skip bleach or silver retention, is an optical effect which entails either the partial or complete skipping of the bleaching function during the processing of a color film.</p>
<p>By doing this, the silver is retained in the emulsion along with the color dyes. The result is a black and white image over a color image. The images usually would have reduced saturation and exposure latitude, along with increased contrast and graininess. It usually is used to maximal effect in conjunction with a one-stop underexposure.</p>
<p>Here is quick tutorial for achieving a Bleach bypass technique in Photoshop:</p>
<p>1. Open your image in Photoshop</p>
<p style="text-align: center;"><a rel="attachment wp-att-132" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/tara-1/"><img class="size-full wp-image-132  aligncenter" title="tara-1" src="http://starqle.com/wp-content/uploads/2011/02/tara-1.bmp" alt="" /></a></p>
<p>2. Duplicate layer</p>
<p style="text-align: center;"><a rel="attachment wp-att-134" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/layer/"><img class="size-full wp-image-134  aligncenter" title="layer" src="http://starqle.com/wp-content/uploads/2011/02/layer.bmp" alt="" /></a></p>
<p>Then, give name to this new layer with anything you want</p>
<p><a rel="attachment wp-att-133" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/duplicate-layer/"><img class="aligncenter size-full wp-image-133" title="duplicate layer" src="http://starqle.com/wp-content/uploads/2011/02/duplicate-layer.bmp" alt="" /></a></p>
<p>3. Set blending mode of your duplicate layer to “overlay” to preserves the highlights and shadows of the base color</p>
<p style="text-align: center;"><a rel="attachment wp-att-135" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/overlay/"><img class="size-full wp-image-135  aligncenter" title="overlay" src="http://starqle.com/wp-content/uploads/2011/02/overlay.bmp" alt="" /></a></p>
<p>4. Now, we are going to desaturate image a little bit by using Hue and Saturation</p>
<p style="text-align: center;"><a rel="attachment wp-att-136" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/desaturate/"><img class="size-full wp-image-136  aligncenter" title="desaturate" src="http://starqle.com/wp-content/uploads/2011/02/desaturate.bmp" alt="" /></a></p>
<p>Use this adjustment layer to desaturate. Mine is -55.</p>
<p style="text-align: center;"><a rel="attachment wp-att-137" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/adjustment/"><img class="size-full wp-image-137  aligncenter" title="adjustment" src="http://starqle.com/wp-content/uploads/2011/02/adjustment.bmp" alt="" /></a></p>
<p>5.	Our image seems pretty dark, and needs brightness. So, we are going to enlighten the image with Curves.</p>
<p style="text-align: center;"><a rel="attachment wp-att-138" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/curves/"><img class="size-full wp-image-138  aligncenter" title="curves" src="http://starqle.com/wp-content/uploads/2011/02/curves.bmp" alt="" /></a></p>
<p>Here’s what my slider looks like</p>
<p style="text-align: center;"><a rel="attachment wp-att-139" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/slider/"><img class="size-full wp-image-139  aligncenter" title="slider" src="http://starqle.com/wp-content/uploads/2011/02/slider.bmp" alt="" /></a></p>
<p>6.	Here’s my final image</p>
<p style="text-align: center;"><a rel="attachment wp-att-140" href="http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/attachment/final/"><img class="size-full wp-image-140  aligncenter" title="final" src="http://starqle.com/wp-content/uploads/2011/02/final.bmp" alt="" /></a></p>
<div><span style="color: #0000ee; -webkit-text-decorations-in-effect: underline;"><br />
</span></div>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/adobe-photoshop-bleach-bypass-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 Authentication and Authorization with Devise and CanCan (Part 2)</title>
		<link>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-2/</link>
		<comments>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-2/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 04:24:56 +0000</pubDate>
		<dc:creator>iqbalfarabi</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CanCan]]></category>
		<category><![CDATA[Devise]]></category>
		<category><![CDATA[Rails 3]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=126</guid>
		<description><![CDATA[This article is also published in Iqbal&#8217;s blog here. &#8211; This is the second part of two posts tutorial on how to use Devise and CanCan with Rails 3. You can find the first part of this tutorial at the original blog here or at this site here. Where were we? In the previous part, we have used Devise library <a href="http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-2/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>This article is also published in Iqbal&#8217;s blog <a href="http://iqbalfarabi.net/2010/12/16/rails-3-authentication-and-authorization-with-devise-and-cancan-part-2/">here</a>.</p>
<p>&#8211;<br />
This is the second part of two posts tutorial on how to use Devise and CanCan with Rails 3. You can find the first part of this tutorial at the original blog <a href="http://iqbalfarabi.net/?p=19">here</a> or at this site <a href="http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/">here</a>.</p>
<p><strong>Where were we?</strong></p>
<p>In the previous part, we have used Devise library to create our User model in CRUD style. With what we have coded in the previous part, you should now be able to manage users and authenticate them. Now it&#8217;s time to add the roles and define what features they may access.</p>
<p><strong>1. Adding the Roles</strong></p>
<p>This step is pretty traditional, we can just scaffold all the MVC part for our roles. In this article, I only need one attribute that is the name of the role.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rails generate scaffold Role name:string</div></div>
<p><strong>2. Making HABTM relationship between roles and users</strong></p>
<p>We have to do several tasks in this step. The first thing is to manually create the migration file for the habtm table. We do it by first generating the migration file like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rails generate migration UsersHaveAndBelongToManyRoles</div></div>
<p>and then we fill the file with this code:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> UsersHaveAndBelongsToManyRoles <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span><br />
&nbsp; &nbsp; create_table <span style="color:#ff3333; font-weight:bold;">:roles_users</span>, <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">references</span> <span style="color:#ff3333; font-weight:bold;">:role</span>, <span style="color:#ff3333; font-weight:bold;">:user</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span><br />
&nbsp; &nbsp; drop_table <span style="color:#ff3333; font-weight:bold;">:roles_users</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>And do not forget to modify our model files. This is how our role.rb looks like after we modify it:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> Role <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span><br />
&nbsp; has_and_belongs_to_many <span style="color:#ff3333; font-weight:bold;">:users</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>And this is how our user.rb file looks like. Please be noted that we also add :role_ids in the attr_accessible and we add a method to identify the role of the respective user.</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span><br />
&nbsp; has_and_belongs_to_many <span style="color:#ff3333; font-weight:bold;">:roles</span><br />
&nbsp; <br />
&nbsp; <span style="color:#008000; font-style:italic;"># Include default devise modules. Others available are:</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># :token_authenticatable, :confirmable, :lockable and :timeoutable</span><br />
&nbsp; devise <span style="color:#ff3333; font-weight:bold;">:database_authenticatable</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:recoverable</span>, <span style="color:#ff3333; font-weight:bold;">:rememberable</span>, <span style="color:#ff3333; font-weight:bold;">:trackable</span>, <span style="color:#ff3333; font-weight:bold;">:validatable</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># Setup accessible (or protected) attributes for your model</span><br />
&nbsp; attr_accessible <span style="color:#ff3333; font-weight:bold;">:email</span>, <span style="color:#ff3333; font-weight:bold;">:username</span>, <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span>, <span style="color:#ff3333; font-weight:bold;">:remember_me</span>, <span style="color:#ff3333; font-weight:bold;">:role_ids</span><br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> role?<span style="color:#006600; font-weight:bold;">&#40;</span>role<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> !!<span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">roles</span>.<span style="color:#9900CC;">find_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>role.<span style="color:#9900CC;">to_s</span>.<span style="color:#9900CC;">camelize</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>In the views part, we have to modify at least the _form.html.erb from our users view so that we can assign the role to the user from web interface. This is how the file users/_form.html.erb looks like:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;%</span>= form_for<span style="color:#006600; font-weight:bold;">&#40;</span>@user<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">any</span>? <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;div id=&quot;error_explanation&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;h2&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= pluralize<span style="color:#006600; font-weight:bold;">&#40;</span>@user.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">count</span>, <span style="color:#996600;">&quot;error&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span> prohibited this user from being saved:&lt;/h2&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &lt;ul&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">full_messages</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>msg<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= msg <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/li&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &nbsp; &lt;/ul&gt;<br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
&nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@current_method</span> == <span style="color:#996600;">&quot;new&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">password_field</span> <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">password_field</span> <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">for</span> role <span style="color:#9966CC; font-weight:bold;">in</span> Role.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;div&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= check_box_tag <span style="color:#996600;">&quot;user[role_ids][]&quot;</span>, role.<span style="color:#9900CC;">id</span>, <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">roles</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>role<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= role.<span style="color:#9900CC;">name</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;div class=&quot;actions&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">submit</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>Of course you can also modify your index.html.erb and show.html.erb files to show the role of the listed user(s). But I think I leave it to you to do it yourself. After all these tasks, we can run rake task db:migrate.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rake db:migrate</div></div>
<p>In this state, we can now add users and assign them with the roles we desire. But of course each role has not yet identified with any permission by CanCan. That&#8217;s what we&#8217;re going to do in the next step.</p>
<p><strong>3. Adding ability</strong></p>
<p>To use CanCan, we have to make a class that defines the permissions that are given to each role. In CanCan, this is called as &#8220;ability&#8221; and to set it up, we have to create the ability.rb file as part of our models.</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> Ability<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">CanCan::Ability</span><br />
&nbsp; <br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; user <span style="color:#006600; font-weight:bold;">||</span>= User.<span style="color:#9900CC;">new</span> <span style="color:#008000; font-style:italic;"># guest user</span><br />
<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> user.<span style="color:#9900CC;">role</span>? <span style="color:#ff3333; font-weight:bold;">:administrator</span><br />
&nbsp; &nbsp; &nbsp; can <span style="color:#ff3333; font-weight:bold;">:manage</span>, <span style="color:#ff3333; font-weight:bold;">:all</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">elsif</span> user.<span style="color:#9900CC;">role</span>? <span style="color:#ff3333; font-weight:bold;">:operator</span><br />
&nbsp; &nbsp; &nbsp; can <span style="color:#ff3333; font-weight:bold;">:manage</span>, Post<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">else</span> <br />
&nbsp; &nbsp; &nbsp; can <span style="color:#ff3333; font-weight:bold;">:read</span>, <span style="color:#ff3333; font-weight:bold;">:all</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>CanCan use a very pleasant way to describe our roles and it&#8217;s corresponding allowed features. In our code above, we use the keyword &#8220;can&#8221; and then follow it with the level of authorization we want the respective role to have and at last we end it with the name of the model. The level of authorizations that I have tried so far is :create, :read, :update, :delete, and :manage. Maybe there is a way to define another ability, you can find about it in depth in the official Github page of CanCan library <a href="https://github.com/ryanb/cancan">here</a>.</p>
<p><strong>4. Adding authorization</strong></p>
<p>Finally, in every controller that needs authorization, we add this line:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">load_and_authorize_resource</div></div>
<p><strong>Final Words</strong></p>
<p>I think that&#8217;s it for now. I know I only have covered the basic part of using Devise and CanCan but I hope this can be helpful for anyone that just starts to learn about both libraries. I may add a working source code to this tutorial later. Meanwhile, if you have any trouble following this tutorial, you can ask me in the comment section.</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Rails 3 Authentication and Authorization with Devise and CanCan (Part 1)</title>
		<link>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/</link>
		<comments>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 04:23:08 +0000</pubDate>
		<dc:creator>iqbalfarabi</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CanCan]]></category>
		<category><![CDATA[Devise]]></category>
		<category><![CDATA[Rails 3]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=128</guid>
		<description><![CDATA[This article is also published in Iqbal&#8217;s blog here. &#8211; Recently, I was involved in a new project that uses Rails 3. That was my first Rails 3 project, I&#8217;ve always used Rails 2 before. Therefore, I tried to get accustomed to how Rails 3 works and how it differs from Rails 2. One thing that I really had to <a href="http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>This article is also published in Iqbal&#8217;s blog <a href="http://iqbalfarabi.net/2010/11/26/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/">here</a>.</p>
<p>&#8211;<br />
Recently, I was involved in a new project that uses Rails 3. That was my first Rails 3 project, I&#8217;ve always used Rails 2 before. Therefore, I tried to get accustomed to how Rails 3 works and how it differs from Rails 2. One thing that I really had to change back then was what authentication and authorization plugin to use. In my previous projects, I always used Authlogic and Lockdown. When I started this particular project, it seemed that both Authlogic and Lockdown was not Rails 3 ready (but I heard now both are Rails 3 ready). So I decided to give a try to different plugins. That&#8217;s how I found Devise and CanCan.</p>
<p>Most part of this writing is heavily duplicated from tutorials from <a href="https://github.com/plataformatec/devise">Devise&#8217;s official github page</a>,<a href="http://asciicasts.com/episodes/192-authorization-with-cancan"> Asciicast&#8217;s episode on CanCan</a> by Ryan Bates, and <a href="http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/">Tony Amoyal&#8217;s tutorial</a>. I took most of the codes from these resources and then slightly modified it to meet my own needs. In this post, I try to share my experience working with both Devise and CanCan. I&#8217;ll explain it in a step-by-step style, maybe some steps are just too obvious for expert readers, please bear with it.</p>
<p><strong>The Project</strong></p>
<p>I wanted to have a user management feature. In the project, we had several roles with predefined sets of features that each role can access. The system has an administrator roles. Users can&#8217;t freely register to the system, the admins add them to the system and then assign a role to them. In the actual system I worked with, users passwords are generated by the application and then sent to the respective user&#8217;s mail. To keep this post simple, I&#8217;ll make administrator set the password directly.</p>
<p><strong>1. Adding needed gems</strong></p>
<p>Add these lines to your Gemfile:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gem <span style="color:#996600;">'devise'</span><br />
gem <span style="color:#996600;">'cancan'</span></div></div>
<p>then install the gems with this command from your command line:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bundle <span style="color: #c20cb9; font-weight: bold;">install</span></div></div>
<p><strong>2. Adding Devise to your project</strong></p>
<p>Run these commands from your command line:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rails generate devise:<span style="color: #c20cb9; font-weight: bold;">install</span><br />
rails generate devise User</div></div>
<p><strong>3. Modifying user model and migration file</strong></p>
<p>As said before, I needed the user management feature to be able to add, delete, and modify users through a CRUD mechanism. Therefore, there are several things we need to change in our user model and migration file. First, we delete the &#8220;registerable&#8221; attribute.  Second, we add a &#8220;username&#8221; attribute to the model and to the migration file. Here is how your user model should look like:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Include default devise modules. Others available are:</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># :token_authenticatable, :confirmable, :lockable and :timeoutable</span><br />
&nbsp; devise <span style="color:#ff3333; font-weight:bold;">:database_authenticatable</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:recoverable</span>, <span style="color:#ff3333; font-weight:bold;">:rememberable</span>, <span style="color:#ff3333; font-weight:bold;">:trackable</span>, <span style="color:#ff3333; font-weight:bold;">:validatable</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># Setup accessible (or protected) attributes for your model</span><br />
&nbsp; attr_accessible <span style="color:#ff3333; font-weight:bold;">:email</span>, <span style="color:#ff3333; font-weight:bold;">:username</span>, <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span>, <span style="color:#ff3333; font-weight:bold;">:remember_me</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>and your migration file for user should look like this:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> DeviseCreateUsers <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span><br />
&nbsp; &nbsp; create_table<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:users</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">database_authenticatable</span> <span style="color:#ff3333; font-weight:bold;">:null</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">recoverable</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">rememberable</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">trackable</span><br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#CC0066; font-weight:bold;">string</span> <span style="color:#ff3333; font-weight:bold;">:username</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># t.confirmable</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># t.lockable :lock_strategy =&gt; :failed_attempts, :unlock_strategy =&gt; :both</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># t.token_authenticatable</span><br />
<br />
<br />
&nbsp; &nbsp; &nbsp; t.<span style="color:#9900CC;">timestamps</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; &nbsp; add_index <span style="color:#ff3333; font-weight:bold;">:users</span>, <span style="color:#ff3333; font-weight:bold;">:email</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:unique</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><br />
&nbsp; &nbsp; add_index <span style="color:#ff3333; font-weight:bold;">:users</span>, <span style="color:#ff3333; font-weight:bold;">:reset_password_token</span>, <span style="color:#ff3333; font-weight:bold;">:unique</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><br />
&nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># add_index :users, :confirmation_token, &nbsp; :unique =&gt; true</span><br />
&nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># add_index :users, :unlock_token, &nbsp; &nbsp; &nbsp; &nbsp; :unique =&gt; true</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span><br />
&nbsp; &nbsp; drop_table <span style="color:#ff3333; font-weight:bold;">:users</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p><strong>4. Modifying the routes</strong></p>
<p>When we installed Devise, it added it&#8217;s own routes to our routes.rb file. Since we want to have CRUD ability, we have to add another routes for our user resources. So this is what we do:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#6666ff; font-weight:bold;">DeviseTest::Application</span>.<span style="color:#9900CC;">routes</span>.<span style="color:#9900CC;">draw</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; devise_for <span style="color:#ff3333; font-weight:bold;">:users</span><br />
&nbsp; resources <span style="color:#ff3333; font-weight:bold;">:users</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># add another lines as you need...</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p><strong>5. Creating the controller and views</strong></p>
<p>In this step, we can just use a generic controller and views template that usually created when you use rails generator to do a scaffolding. Anyway, this is how my <em>users_controller.rb</em> looks:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> UsersController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController<br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> index<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@users</span> = User.<span style="color:#9900CC;">all</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#008000; font-style:italic;"># index.html.erb</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@users</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users/1</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users/1.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> show<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#008000; font-style:italic;"># show.html.erb</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users/new</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users/new.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> new<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">new</span><br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@current_method</span> = <span style="color:#996600;">&quot;new&quot;</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#008000; font-style:italic;"># new.html.erb</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># GET /users/1/edit</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> edit<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># POST /users</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># POST /users.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> create<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:user</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">save</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span> redirect_to<span style="color:#006600; font-weight:bold;">&#40;</span>@user, <span style="color:#ff3333; font-weight:bold;">:notice</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'User was successfully created.'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span>, <span style="color:#ff3333; font-weight:bold;">:status</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:created</span>, <span style="color:#ff3333; font-weight:bold;">:location</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;new&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>, <span style="color:#ff3333; font-weight:bold;">:status</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:unprocessable_entity</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># PUT /users/1</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># PUT /users/1.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> update<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">update_attributes</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:user</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span> redirect_to<span style="color:#006600; font-weight:bold;">&#40;</span>@user, <span style="color:#ff3333; font-weight:bold;">:notice</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'User was successfully updated.'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> head <span style="color:#ff3333; font-weight:bold;">:ok</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;edit&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>, <span style="color:#ff3333; font-weight:bold;">:status</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:unprocessable_entity</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#008000; font-style:italic;"># DELETE /users/1</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># DELETE /users/1.xml</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> destroy<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span> = User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">destroy</span><br />
<br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#006600; font-weight:bold;">&#123;</span> redirect_to<span style="color:#006600; font-weight:bold;">&#40;</span>users_url<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> head <span style="color:#ff3333; font-weight:bold;">:ok</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Again, although this is a generated view, I&#8217;ll include it here anyway. Here&#8217;s our <em>_form.html.erb</em>:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;%</span>= form_for<span style="color:#006600; font-weight:bold;">&#40;</span>@user<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">any</span>? <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;div id=&quot;error_explanation&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;h2&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= pluralize<span style="color:#006600; font-weight:bold;">&#40;</span>@user.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">count</span>, <span style="color:#996600;">&quot;error&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span> prohibited this user from being saved:&lt;/h2&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &lt;ul&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">full_messages</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>msg<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= msg <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/li&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &nbsp; &lt;/ul&gt;<br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
&nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@current_method</span> == <span style="color:#996600;">&quot;new&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">password_field</span> <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; &nbsp; &lt;div class=&quot;field&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;<br />
&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">password_field</span> <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;div class=&quot;actions&quot;&gt;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">submit</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &lt;/div&gt;<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>Our <em>edit.html.erb</em>:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;h1&gt;Editing user&lt;/h1&gt;<br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= render <span style="color:#996600;">'form'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Show'</span>, <span style="color:#0066ff; font-weight:bold;">@user</span> <span style="color:#006600; font-weight:bold;">%&gt;</span> |<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Back'</span>, users_path <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>Our <em>index.html.erb</em>:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;h1&gt;Listing users&lt;/h1&gt;<br />
<br />
&lt;table&gt;<br />
&nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &lt;th&gt;Email&lt;/th&gt;<br />
&nbsp; &nbsp; &lt;th&gt;Username&lt;/th&gt;<br />
&nbsp; &lt;/tr&gt;<br />
<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#0066ff; font-weight:bold;">@users</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>user<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= user.<span style="color:#9900CC;">email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= user.<span style="color:#9900CC;">username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Show'</span>, user <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Edit'</span>, edit_user_path<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Destroy'</span>, user, <span style="color:#ff3333; font-weight:bold;">:confirm</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Are you sure?'</span>, <span style="color:#ff3333; font-weight:bold;">:method</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:delete</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;<br />
&nbsp; &nbsp; &lt;/tr&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&lt;/table&gt;<br />
<br />
&lt;br /&gt;<br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'New user'</span>, new_user_path <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>Our <em>new.html.erb</em>:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;h1&gt;New user&lt;/h1&gt;<br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= render <span style="color:#996600;">'form'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Back'</span>, users_path <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>And the last&#8230; our <em>show.html.er</em>b:</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;p id=&quot;notice&quot;&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= notice <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/p&gt;<br />
<br />
&lt;p&gt;<br />
&nbsp; &lt;b&gt;Email:&lt;/b&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">email</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&lt;/p&gt;<br />
<br />
&lt;p&gt;<br />
&nbsp; &lt;b&gt;Username:&lt;/b&gt;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#0066ff; font-weight:bold;">@user</span>.<span style="color:#9900CC;">username</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&lt;/p&gt;<br />
<br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Edit'</span>, edit_user_path<span style="color:#006600; font-weight:bold;">&#40;</span>@user<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span> |<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">'Back'</span>, users_path <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p><strong>6. Using the Devise</strong></p>
<p>In order Devise to really work, we have to put this line in every controller that can only be accessed by authenticated users.</p>
<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">before_filter <span style="color:#ff3333; font-weight:bold;">:authenticate_user</span>!</div></div>
<p><strong>Next Step</strong></p>
<p>Well, it&#8217;s a long post already&#8230; . I guess it&#8217;s better for us to take a break. So, this is the first part. We have not used CanCan yet, but now we have a working user management feature as we wanted it in the beginning. Hope this post helps you with your own project using Devise. I&#8217;ll write the second part where we will use CanCan as soon as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/articles/rails-3-authentication-and-authorization-with-devise-and-cancan-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ruang Main at Tempo Magazine</title>
		<link>http://starqle.com/news/ruangmain-at-tempo-magazine/</link>
		<comments>http://starqle.com/news/ruangmain-at-tempo-magazine/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 03:45:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Ruang Main]]></category>

		<guid isPermaLink="false">http://starqle.com/?p=93</guid>
		<description><![CDATA[A month after nominated in Indonesia ICT Award 2010, our product named Ruang Main is now featured as an article in Tempo magazine both in printed and online edition. Below is the fully copied article from the online edition written in Bahasa Indonesia. UPDATE (05/04/2011): due to some questions directed to as via our feedback form, we would like you <a href="http://starqle.com/news/ruangmain-at-tempo-magazine/" title="Read more">&#8230;</a>]]></description>
			<content:encoded><![CDATA[<p>A month after nominated in Indonesia ICT Award 2010, our product named <a title="Ruang Main" href="http://ruangmain.com">Ruang Main</a> is now featured as an article in Tempo magazine both in printed and online edition.  Below is the fully copied article from the online edition written in Bahasa Indonesia.</p>
<p><strong>UPDATE (05/04/2011): due to some questions directed to as via our feedback form, we would like you to know that Ruang Main is not yet available for public use. It is still on private beta testing state. We do hope we can bring this to public as soon as possible. Stay tune. :)</strong></p>
<p>&#8211;<br />
DENGAN lebih dari 500 juta pengguna, Facebook merupakan sebuah dunia. Seperti situs jaringan sosial lainnya, di dalam Facebook ada pertemanan, bisnis, politik, tapi juga ada peluang kejahatan yang diam-diam mengintip.</p>
<p>Noni, 14 tahun, bukan nama sebenarnya, dirayu dan akhirnya dinodai teman yang dikenalnya lewat Facebook. Gadis belia asal Sidoarjo, Jawa Timur, itu semula hanya mengenal Ari, 18 tahun, warga Tangerang, Banten, lewat Facebook dan pesan pendek. Mereka tak pernah bertemu langsung. Ketika akhirnya bertemu di Jakarta, awal tahun lalu, Noni begitu saja percaya kepada teman mayanya itu dan meninggalkan orang tuanya. Lima hari kemudian, Noni baru ditemukan polisi.</p>
<p>Kasus serupa terjadi pada Abigail, 15 tahun, juga bukan nama sebenarnya. Siswi sekolah menengah atas di Surabaya ini pergi ke Jakarta bersama Joni, yang hanya dikenalnya lewat Facebook. &#8220;Dia pamit hendak menonton pertandingan basket,&#8221; kata orang tua Abigail, beberapa bulan lalu. Di Jakarta, Abigail begitu saja ditinggal pergi Joni.</p>
<p>Ketua Umum Komisi Nasional Perlindungan Anak, Arist Merdeka Sirait, mengatakan kasus kejahatan terhadap anak lewat Internet terus menunjukkan peningkatan. Berdasarkan laporan yang masuk ke Komisi Nasional, pada 2009, ada 26 kasus kejahatan terhadap anak-anak. &#8220;Untuk 2010, sampai sekarang sudah ada 21 kasus,&#8221; kata Arist pekan lalu. Mereka tersebar di berbagai kota di Indonesia. Sebagian besar dari anak-anak itu menjadi korban kekerasan seksual.</p>
<p>Modus merayu gadis belia dan anak-anak lewat situs jaringan sosial atau chatting tak cuma monopoli Indonesia, tapi juga terjadi di pelbagai negara. Dengan memalsukan identitas, Christopher M. Spiehler, 29 tahun, merayu anak perempuan berumur 11 tahun lewat jaringan VampireFreaks.com, situs bagi para penggemar cerita vampir. Warga Hancock County, Mississippi, Amerika Serikat, itu kemudian membawa kabur dan memerkosa anak tersebut.</p>
<p>Jika tidak hati-hati berseluncur di Internet, anak-anak bisa menjadi sasaran empuk para pemangsa ini. Menurut laporan Internet Watch Foundation di Inggris, ada 8.844 alamat Internet di seluruh dunia yang menjadi ajang pertukaran materi pornografi anak-anak. Hampir separuhnya beralamat server di Amerika Serikat. Sebagian besar materi jorok itu melibatkan anak-anak berumur 6 hingga 12 tahun.</p>
<p>Di Internet, setiap orang dengan gampang memalsukan diri dan menjadi siapa pun yang dia kehendaki. Untuk menghindari para pemangsa ini, menurut Arist Merdeka, yang paling penting adalah memberdayakan orang tua dan mendidik anak bagaimana berinternet dengan sehat. &#8220;Menjauhkan anak dari teknologi bukan solusi,&#8221; katanya. Repotnya, orang tua tak selalu punya waktu untuk memelototi laman demi laman Internet yang dikunjungi si kecil.</p>
<p>Supaya si kecil ini tidak tersesat di belantara Internet, tujuh lulusan teknik informatika Institut Teknologi Bandung yang bergabung di PT Starqle Indonesia membuat Ruang Main. &#8220;Sudah ada investor dalam negeri yang siap membiayai pengembangannya,&#8221; kata Iqbal Farabi, Vice Chief Technology Starqle, pekan lalu. Menurut dia, <a title="Ruang Main" href="http://ruangmain.com">Ruang Main</a> ditujukan bagi anak berumur 6 hingga 12 tahun. Di dalam Ruang Main ini, si kecil bisa dengan aman dan nyaman mengarungi Internet. &#8220;Kami tetap menekankan unsur fun.&#8221;</p>
<p>Ruang Main merupakan gabungan beberapa aplikasi sekaligus konten. Di dalamnya ada peramban alias browser khusus anak-anak, jaringan sosial, aplikasi video, gambar, dan aplikasi kontrol orang tua. Peramban Ruang Main ini, kata Iqbal, dibuat dengan Adobe Flex dan WebKit. WebKit adalah open source engine yang juga digunakan untuk mengembangkan Safari, peramban dalam Apple MacOS X.</p>
<p>Selain tampilannya lebih sederhana dan bergaya anak-anak, ada penyaring di peramban Ruang Main. Berbeda dengan kebanyakan penyaring yang memblokir akses ke daftar hitam alamat-alamat situs jorok atau sumber surat sampah, penyaring Ruang Main memilih metode daftar putih alias white list.</p>
<p>Dengan cara ini, peramban Ruang Main akan mengarahkan si kecil mengunjungi situs yang ada di daftar putih. Akses ke situs yang tak ada di daftar putih akan ditolak. Untuk menyusun daftar putih ini, Starqle akan melibatkan para guru. &#8220;Nanti kami juga akan melibatkan komunitas orang tua,&#8221; ujar Iqbal.</p>
<p>Metode daftar putih ini juga dipakai peramban anak-anak seperti KidZui, KidRocket, dan Kido&#8217;z. KidRocket, misalnya, untuk memasukkan Barbie.com, Sesamestreet.com, Crayola.com, Disney.com, dan situs Nickelodeon ke daftar putihnya.</p>
<p>Di dalam Ruang Main, anak-anak bebas menjelajahi konten video, gambar, atau materi pendidikan. Si kecil boleh asyik masyuk dengan game yang ada di Ruang Main. Untuk memperkaya konten di Ruang Main, kata Iqbal, Starqle akan bekerja sama dengan para pengembang konten. &#8220;Tapi semua konten tetap harus lewat persetujuan komunitas orang tua,&#8221; Iqbal menekankan. Lewat jaringan sosial Ruang Main, si kecil juga bisa berinteraksi, mengunggah foto atau video, mengomentari, dan berbagi konten dengan teman-temannya.</p>
<p>Sebagai acuan untuk jaringan sosial Ruang Main, Iqbal mengatakan, mereka merujuk ke TogetherVille.com dan KidZui. TogetherVille adalah jaringan sosial Internet khusus bagi anak-anak berumur 6 hingga 10 tahun yang dibuat oleh Mandeph Singh Dhillon. Facebook, MySpace, atau Friendster tidak menjadi acuan, karena memang didesain untuk usia di atas 13 tahun.</p>
<p>Tidak seperti Facebook atau Friendster, di TogetherVille, yang baru diluncurkan Mei lalu, profil dan gambar setiap anak sepenuhnya tertutup. Orang lain tidak bisa mengintip foto atau data anak-anak di TogetherVille. Si kecil hanya bisa mengundang teman-teman yang benar-benar dikenalnya sehari-hari. Dan aktivitas si kecil di Internet ini semua bisa dikendalikan orang tua masing-masing.</p>
<p>Di Ruang Main ini, peran orang tua tetap menjadi kunci keamanan bagi anaknya. Sebab, belum ada cara yang benar-benar mujarab untuk melacak keaslian identitas yang dipakai di Internet. Orang tua bisa mengusulkan situs Internet masuk ke daftar putih. Mereka juga bisa memblokir akses anaknya ke salah satu situs ataupun konten, sekalipun alamat itu ada di daftar putih.</p>
<p>Orang tua akan selalu mendapat pemberitahuan setiap kali ada orang hendak berkenalan dengan anaknya. Orang tua juga bisa mengatur berapa lama anaknya boleh berselancar di Internet. &#8220;Bahkan mereka juga bisa menentukan kata-kata apa saja yang bisa dipakai anaknya dalam fasilitas pencarian,&#8221; kata Iqbal.</p>
<p>Sempat tertatih-tatih karena kurang dana, kini setelah mendapat investor baru, Starqle menggeber pengembangan Ruang Main. Mereka memasang target, versi beta Ruang Main akan kelar dalam dua bulan ini. Sehingga pada Januari tahun depan semua anak sudah bisa bermain-main di Ruang Main.</p>
<p>&#8211;</p>
<p>Original source of this article can be found <a href="http://majalah.tempointeraktif.com/id/arsip/2010/08/30/ILT/mbm.20100830.ILT134481.id.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://starqle.com/news/ruangmain-at-tempo-magazine/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

