<?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>Cory O&#039;Daniel - These are just words &#187; padrino</title>
	<atom:link href="http://coryodaniel.com/index.php/tag/padrino/feed/" rel="self" type="application/rss+xml" />
	<link>http://coryodaniel.com</link>
	<description>Software development, thoughts, and randomness</description>
	<lastBuildDate>Thu, 17 Nov 2011 21:18:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>methods_like helper for finding ruby methods</title>
		<link>http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/</link>
		<comments>http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 01:06:05 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[console irb]]></category>
		<category><![CDATA[methods]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[padrino]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=543</guid>
		<description><![CDATA[Here is a little gem I have in my ~/.irbrc I use it a lot when debugging code. I tend to use call #methods a lot on objects to figure out how they quack. 
Sometimes I can remember kinda what a method's name is I want to use, but doing something like the following can [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a little gem I have in my ~/.irbrc I use it a lot when debugging code. I tend to use call #methods a lot on objects to figure out how they quack. </p>
<p>Sometimes I can remember kinda what a method's name is I want to use, but doing something like the following can generate a huge amount of output especially when working with ActiveRecord</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">my_object.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">sort</span></pre></td></tr></table></div>

<p>So I threw together this little method that adds to ruby's base Object class</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> methods_like<span style="color:#006600; font-weight:bold;">&#40;</span>pat<span style="color:#006600; font-weight:bold;">&#41;</span>
    pattern =  pat.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">String</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{pat}/ : pat</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">sort</span>.<span style="color:#CC0066; font-weight:bold;">select</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>m<span style="color:#006600; font-weight:bold;">|</span>
      m =~ pattern
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Now from IRB, Rails console, or Padrino console you can do things like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">my_collection.<span style="color:#9900CC;">methods_like</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>^update<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#=&gt; [ array of method names that start with update ]</span>
user.<span style="color:#9900CC;">methods_like</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;name&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#=&gt; [ :first_name, :last_name, :etc ]</span>
<span style="color:#CC0066; font-weight:bold;">Array</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">methods_like</span> <span style="color:#996600;">&quot;sort&quot;</span> <span style="color:#008000; font-style:italic;">#=&gt; [&quot;sort&quot;, &quot;sort!&quot;, &quot;sort_by&quot;]</span></pre></div></div>

<p>Its a handy little snippet when you can't remember an exact method name, and generally for me works faster than googling for it. Toss it in your ~/.irbrc and tell me what you think.</p>
<p><strong>UPDATE</strong><br />
I added some more functionality for getting additional methods (private, protected, singleton):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>
  <span style="color:#008000; font-style:italic;"># pattern - string or pattern to match</span>
  <span style="color:#008000; font-style:italic;"># access  - :public, :private, :protected, :singleton, :all</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> methods_like<span style="color:#006600; font-weight:bold;">&#40;</span>pattern, access = <span style="color:#ff3333; font-weight:bold;">:public</span>, details = <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>    
    master_method_list = <span style="color:#9966CC; font-weight:bold;">case</span> access
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#ff3333; font-weight:bold;">:public</span> <span style="color:#9966CC; font-weight:bold;">then</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">methods</span>
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#ff3333; font-weight:bold;">:private</span> <span style="color:#9966CC; font-weight:bold;">then</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">private_methods</span>
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#ff3333; font-weight:bold;">:protected</span> <span style="color:#9966CC; font-weight:bold;">then</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">protected_methods</span> 
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#ff3333; font-weight:bold;">:singleton</span> <span style="color:#9966CC; font-weight:bold;">then</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">singleton_methods</span>
    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#ff3333; font-weight:bold;">:all</span>
      <span style="color:#006600; font-weight:bold;">&#40;</span>
        <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">methods</span>            <span style="color:#006600; font-weight:bold;">+</span>
        <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">private_methods</span>    <span style="color:#006600; font-weight:bold;">+</span>
        <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">protected_methods</span>  <span style="color:#006600; font-weight:bold;">+</span>
        <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">singleton_methods</span>
      <span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">uniq</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    matched_method_list = master_method_list.<span style="color:#9900CC;">sort</span>.<span style="color:#CC0066; font-weight:bold;">select</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>m<span style="color:#006600; font-weight:bold;">|</span> m =~ <span style="color:#006600; font-weight:bold;">&#40;</span> pattern.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">String</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{pattern}/ : pattern ) }</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">if</span> !details
      matched_method_list
    <span style="color:#9966CC; font-weight:bold;">else</span>
      details_list = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
      matched_method_list.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>current_method<span style="color:#006600; font-weight:bold;">|</span>
        details_list<span style="color:#006600; font-weight:bold;">&#91;</span>current_method<span style="color:#006600; font-weight:bold;">&#93;</span> = method_details<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      details_list
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Returns details about method</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> method_details<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
    current_method = current_method.<span style="color:#9900CC;">to_s</span>
    access_level = <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">methods</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#ff3333; font-weight:bold;">:public</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">private_methods</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#ff3333; font-weight:bold;">:private</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">protected_methods</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#ff3333; font-weight:bold;">:protected</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">singleton_methods</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#ff3333; font-weight:bold;">:singleton</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#006600; font-weight:bold;">&#123;</span>
      <span style="color:#ff3333; font-weight:bold;">:owner</span>    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">method</span><span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">owner</span>,
      <span style="color:#ff3333; font-weight:bold;">:arity</span>    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">method</span><span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">arity</span>,
      <span style="color:#ff3333; font-weight:bold;">:receiver</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">method</span><span style="color:#006600; font-weight:bold;">&#40;</span>current_method<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">receiver</span>,
      <span style="color:#ff3333; font-weight:bold;">:access</span>   <span style="color:#006600; font-weight:bold;">=&gt;</span> access_level
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now you can do:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">variable.<span style="color:#9900CC;">methods_like</span> pattern, <span style="color:#ff3333; font-weight:bold;">:private</span> <span style="color:#008000; font-style:italic;">#=&gt; Array of private methods with pattern</span>
variable.<span style="color:#9900CC;">methods_like</span> pattern, <span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#008000; font-style:italic;">#=&gt; Hash of methods with additional details</span></pre></div></div>

<p>If you pass 'true' for details you will get a hash that looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">Array</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">methods_like</span> <span style="color:#996600;">&quot;sort&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#008000; font-style:italic;">#=&gt;</span>
<span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#996600;">&quot;sort_by&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#123;</span>:owner<span style="color:#006600; font-weight:bold;">=&gt;</span>Enumerable, <span style="color:#ff3333; font-weight:bold;">:access</span><span style="color:#006600; font-weight:bold;">=&gt;</span>:public, <span style="color:#ff3333; font-weight:bold;">:receiver</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:arity</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span>, 
  <span style="color:#996600;">&quot;sort!&quot;</span>    <span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#123;</span>:owner<span style="color:#006600; font-weight:bold;">=&gt;</span>Array, <span style="color:#ff3333; font-weight:bold;">:access</span><span style="color:#006600; font-weight:bold;">=&gt;</span>:public, <span style="color:#ff3333; font-weight:bold;">:receiver</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:arity</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span>, 
  <span style="color:#996600;">&quot;sort&quot;</span>     <span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#123;</span>:owner<span style="color:#006600; font-weight:bold;">=&gt;</span>Array, <span style="color:#ff3333; font-weight:bold;">:access</span><span style="color:#006600; font-weight:bold;">=&gt;</span>:public, <span style="color:#ff3333; font-weight:bold;">:receiver</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:arity</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>Access options available are :public, :private, :singleton, :protected, :all</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=methods_like+helper+for+finding+ruby+methods+http://coryodaniel.com/?p=543" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/&amp;title=methods_like+helper+for+finding+ruby+methods" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/&amp;t=methods_like+helper+for+finding+ruby+methods" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/&amp;title=methods_like+helper+for+finding+ruby+methods" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/&amp;title=methods_like+helper+for+finding+ruby+methods" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2010/11/02/methods_like-helper-for-finding-ruby-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Padrino, Compass, and Sass &#8211; Working happily via Ian Serlin</title>
		<link>http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/</link>
		<comments>http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 22:22:59 +0000</pubDate>
		<dc:creator>Cory O'Daniel</dc:creator>
				<category><![CDATA[RubyDevelopment]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[padrino]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sass]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://coryodaniel.com/?p=500</guid>
		<description><![CDATA[My cohort, Ian Serlin, discovered this.  In a project we are working on we could get Compass to play well with PadrinoRb.  It seems like the #sass method doesn't care about the options being passed to it, and we kept getting stack traces rendered into our CSS files. The stack trace was ruby [...]]]></description>
			<content:encoded><![CDATA[<p>My cohort, Ian Serlin, discovered this.  In a project we are working on we could get Compass to play well with PadrinoRb.  It seems like the #sass method doesn't care about the options being passed to it, and we kept getting stack traces rendered into our CSS files. The stack trace was ruby looking for - and failing to find compass/reset.css.</p>
<p>This is the code that DOESN'T work (padrino 0.9.10, compass 0.8.17, sinatra 1.0).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">  configure <span style="color:#9966CC; font-weight:bold;">do</span>
    register SassInitializer <span style="color:#008000; font-style:italic;">#The Rack Sass reloader...</span>
&nbsp;
    Compass.<span style="color:#9900CC;">configuration</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span>
      config.<span style="color:#9900CC;">project_path</span> = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      config.<span style="color:#9900CC;">sass_dir</span> = <span style="color:#996600;">&quot;stylesheets&quot;</span>
      config.<span style="color:#9900CC;">project_type</span> = <span style="color:#ff3333; font-weight:bold;">:stand_alone</span>
      config.<span style="color:#9900CC;">http_path</span> = <span style="color:#996600;">&quot;/&quot;</span>
      config.<span style="color:#9900CC;">css_dir</span> = <span style="color:#996600;">&quot;stylesheets&quot;</span>
      config.<span style="color:#9900CC;">images_dir</span> = <span style="color:#996600;">&quot;images&quot;</span>
      config.<span style="color:#9900CC;">output_style</span> = <span style="color:#ff3333; font-weight:bold;">:compressed</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>   
  get <span style="color:#996600;">'/stylesheets/:file.css'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    content_type <span style="color:#996600;">'text/css'</span>, <span style="color:#ff3333; font-weight:bold;">:charset</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'utf-8'</span>
    <span style="color:#008000; font-style:italic;"># This is the doc on how to give Sass some more load paths to find the compass  files. </span>
    <span style="color:#008000; font-style:italic;">#   it doesnt work :P and for that matter, neither does:</span>
    <span style="color:#008000; font-style:italic;"># sass :file, Compass.sass_engine_options</span>
    <span style="color:#008000; font-style:italic;"># or the set :sass, whatever_hash_here</span>
    sass <span style="color:#ff3333; font-weight:bold;">:file</span>, <span style="color:#ff3333; font-weight:bold;">:sass</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Compass.<span style="color:#9900CC;">sass_engine_options</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Our solution was to force Sass options and Compass options to merge...</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">  configure <span style="color:#9966CC; font-weight:bold;">do</span>
    register SassInitializer
&nbsp;
    Compass.<span style="color:#9900CC;">configuration</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span>
      config.<span style="color:#9900CC;">project_path</span> = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      config.<span style="color:#9900CC;">sass_dir</span> = <span style="color:#996600;">&quot;stylesheets&quot;</span>
      config.<span style="color:#9900CC;">project_type</span> = <span style="color:#ff3333; font-weight:bold;">:stand_alone</span>
      config.<span style="color:#9900CC;">http_path</span> = <span style="color:#996600;">&quot;/&quot;</span>
      config.<span style="color:#9900CC;">css_dir</span> = <span style="color:#996600;">&quot;stylesheets&quot;</span>
      config.<span style="color:#9900CC;">images_dir</span> = <span style="color:#996600;">&quot;images&quot;</span>
      config.<span style="color:#9900CC;">output_style</span> = <span style="color:#ff3333; font-weight:bold;">:compressed</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#6666ff; font-weight:bold;">Sass::Plugin</span>.<span style="color:#9900CC;">options</span>.<span style="color:#9900CC;">merge</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>Compass.<span style="color:#9900CC;">sass_engine_options</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  get <span style="color:#996600;">'/stylesheets/:file.css'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    content_type <span style="color:#996600;">'text/css'</span>, <span style="color:#ff3333; font-weight:bold;">:charset</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'utf-8'</span>
    sass <span style="color:#ff3333; font-weight:bold;">:file</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Yay, magic spells - it works. You can check out more ian magic spells at ianserlin.com.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Padrino%2C+Compass%2C+and+Sass+%E2%80%93+Working+happily+via+Ian+Serlin+http://coryodaniel.com/?p=500" title="Post to Twitter"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a class="tt" href="http://digg.com/submit?url=http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/&amp;title=Padrino%2C+Compass%2C+and+Sass+%E2%80%93+Working+happily+via+Ian+Serlin" title="Post to Digg"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-digg-big2.png" alt="Post to Digg" /></a> <a class="tt" href="http://www.facebook.com/share.php?u=http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/&amp;t=Padrino%2C+Compass%2C+and+Sass+%E2%80%93+Working+happily+via+Ian+Serlin" title="Post to Facebook"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-facebook-big2.png" alt="Post to Facebook" /></a> <a class="tt" href="http://reddit.com/submit?url=http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/&amp;title=Padrino%2C+Compass%2C+and+Sass+%E2%80%93+Working+happily+via+Ian+Serlin" title="Post to Reddit"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-reddit-big2.png" alt="Post to Reddit" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/&amp;title=Padrino%2C+Compass%2C+and+Sass+%E2%80%93+Working+happily+via+Ian+Serlin" title="Post to StumbleUpon"><img class="nothumb" src="http://coryodaniel.com/wp-content/plugins/tweet-this/icons/tt-su-big2.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://coryodaniel.com/index.php/2010/04/17/padrino-compass-and-sass-working-happily-via-ian-serlin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

