Nick Sieger: RailsConf Europe: David Heinemeier Hansson tag:blog.nicksieger.com,2005:Typo Typo 2007-09-21T10:24:22+00:00 Pratik urn:uuid:b24da1c9-af02-479d-bb15-9dad45779b13 2007-09-21T10:24:22+00:00 2007-09-21T10:24:22+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Pratik <p>David just used iPhone as an example. Rails doesn&#8217;t have &#8220;optimization&#8221; done for iPhone speicifically. The main idea is, you can set the fomat using request.format= based on any request env params. For example, it can be used to do some specific rendering for r&#8217;tard IE in just the same way.</p> <p>Another thing he missed was, when you set content_type => Mime::HTML, rails will use layout.html.erb as layout.</p> Jon Arbuckle urn:uuid:7341b536-ee79-442f-8bc2-0a6121406d79 2007-09-21T10:01:54+00:00 2007-09-21T10:01:54+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Jon Arbuckle <p>@Michael</p> <p>That is because in the Rails world, it is uncool to use anything not made by Apple (unless Apple is not in that market). You should know this by now.</p> Michael urn:uuid:0b9ced1e-b390-4d7c-bcd9-61c68c575b81 2007-09-18T19:50:12+00:00 2007-09-18T19:50:13+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Michael <p>Why optimize just for the IPhone? There are a lot of phones/devices out there. Why not make it so it&#8217;ll work on all devices that supports a certain level of html+css etc? </p> <p>Opera Mobile and Opera Mini can display any page on almost any device. Why not try your application on that today? <a href='http://www.operamini.com/beta/simulator/' rel="nofollow">http://www.operamini.com/beta/simulator/</a></p> Ben urn:uuid:d6979bb9-2781-430b-92a9-6dc681d94a06 2007-09-18T16:26:49+00:00 2007-09-18T16:26:49+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Ben <p>I&#8217;m liking the custom layouts, such as the iPhone example. With the announcement of the UK iPhone launch today I can&#8217;t wait to work on an optimised version of my Rails app.</p> Nick urn:uuid:6152a27e-e5c5-4303-8f9c-4d9974eb4b2c 2007-09-18T14:15:58+00:00 2007-09-18T14:15:58+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Nick <p>Even better! Thanks for the clarification.</p> Pratik urn:uuid:fb705557-e96b-455c-9fae-e84dfd995771 2007-09-18T09:10:31+00:00 2007-09-18T09:10:31+00:00 Comment on RailsConf Europe: David Heinemeier Hansson by Pratik <p>Verified patch report is empty because all the patches are applied very soon they become verified. </p> <p>So, an empty report is not scarse, it&#8217;s just a sign of success!</p> Nick Sieger urn:uuid:b1cf2100-7876-4946-9082-8b8054a24bd3 2007-09-18T08:14:00+00:00 2007-09-18T14:17:42+00:00 RailsConf Europe: David Heinemeier Hansson <h2>Rebel With a Cause</h2> <p>Rails is no longer the James Dean character, looking outward, trying to convince you of something. It&#8217;s no longer about a rebellion or a revolution. Instead, Rails is settling in as a passionate, inward-looking craftsperson.</p> <p>After the rebellion, settle in and enjoy the results of your work. David hasn&#8217;t been working directly on Rails too much, instead he&#8217;s been enjoying it.</p> <p>And it&#8217;s not about David anymore. It&#8217;s about You (cue the Time Person of the Year cover). David wants Rails to be more friendly to newcomers.</p> <p><a href="http://dev.rubyonrails.org/report/12">Report #12: Verified Patches</a>. Encouraging the community to approve patches, rather than limiting the decisions to the core. Opening up Rails. (Also, unfortunately looking a little scarce at the moment. <em>Update: turns out it&#8217;s empty because patches are quickly applied, not because there aren&#8217;t any submitted!</em>)</p> <p>David screened the original Rails movie &#8211; showing Apache setup, manually creating databases and tables. He quickly lost patience for it.</p> <p>Compare to the current state of the art, with everything down to the routes and migrations gets created for you, lowering the barrier to entry (example: a new rake task <code>db:create:all</code>).</p> <p>Rails 2.0 is largely about continual improvement and removing the cruft:</p> <ul> <li>Cookie-based session store as the default</li> <li>Routing: <code>map.root</code></li> <li>Removing the dynamic <code>scaffold :posts</code> feature</li> <li><code>map.namespace</code> and <code>script/generate controller admin::posts</code></li> <li><code>*.html.erb</code> files with the MIME type and renderer baked into the filename, since the two are now mutually exclusive.</li> <li>Automatically named partials with <code>render :partial =&gt; @posts</code> resolving to <code>_post.html.erb</code></li> <li>Namespacing and named routes:</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="ident">mop</span><span class="punct">.</span><span class="ident">namespace</span> <span class="symbol">:admin</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">admin</span><span class="punct">|</span> <span class="ident">admin</span><span class="punct">.</span><span class="ident">resources</span> <span class="symbol">:posts</span> <span class="keyword">end</span> <span class="comment"># ...</span> <span class="ident">link_to</span> <span class="punct">'</span><span class="string">Show</span><span class="punct">',</span> <span class="punct">[</span><span class="symbol">:admin</span><span class="punct">,</span> <span class="ident">post</span><span class="punct">]</span></code></pre></div> <ul> <li>HTTP authentication</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">Admin::PostsController</span> <span class="punct">&lt;</span> <span class="constant">ApplicationController</span> <span class="ident">before_filter</span> <span class="symbol">:ensure_administrator</span> <span class="comment"># ...</span> <span class="ident">private</span> <span class="keyword">def </span><span class="method">ensure_administrator</span> <span class="ident">authenticate_or_request_with_http_basic</span><span class="punct">(&quot;</span><span class="string">Blog Admin</span><span class="punct">&quot;)</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">user</span><span class="punct">,</span><span class="ident">pass</span><span class="punct">|</span> <span class="ident">username</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">dhh</span><span class="punct">&quot;</span> <span class="punct">&amp;&amp;</span> <span class="ident">password</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">123</span><span class="punct">&quot;</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="keyword">end</span></code></pre></div> <ul> <li>Custom layouts for specific user agents (say, oh, the iPhone). Views can also be rendered, e.g., <code>index.iphone.erb</code>.</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">ApplicationController</span> <span class="punct">&lt;</span> <span class="constant">ActionController</span><span class="punct">::</span><span class="constant">Base</span> <span class="ident">before_filter</span> <span class="symbol">:adjust_format_for_iphone</span> <span class="keyword">def </span><span class="method">adjust_format_for_iphone</span> <span class="keyword">if</span> <span class="ident">request</span><span class="punct">.</span><span class="ident">env</span><span class="punct">[&quot;</span><span class="string">HTTP_USER_AGENT</span><span class="punct">&quot;][/</span><span class="regex">iPhone</span><span class="punct">/]</span> <span class="ident">request</span><span class="punct">.</span><span class="ident">format</span> <span class="punct">=</span> <span class="symbol">:iphone</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="comment"># initializer</span> <span class="constant">Mime</span><span class="punct">::</span><span class="constant">Type</span><span class="punct">.</span><span class="ident">register</span> <span class="punct">&quot;</span><span class="string">application/x-iphone</span><span class="punct">&quot;,</span> <span class="symbol">:iphone</span> <span class="comment"># In a controller method</span> <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span> <span class="ident">format</span><span class="punct">.</span><span class="ident">iphone</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:text</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">Hello iPhone</span><span class="punct">&quot;,</span> <span class="symbol">:content</span> <span class="punct">=&gt;</span> <span class="constant">Mime</span><span class="punct">::</span><span class="constant">HTML</span> <span class="punct">}</span> <span class="keyword">end</span></code></pre></div> <ul> <li><code>atom_feed_helper</code>, a new plugin &#8211; builder for Atom specified in <code>index.atom.builder</code></li> <li><code>&lt;%= yield :head %&gt;</code>, <code>content_for :head { auto_discovery_link(:atom, formatted_posts_url)}</code></li> <li>Debugger &#8211; allows you to be lazy and leave your <code>breakpoint</code>s in your production code, not that you&#8217;d actually want to do that. Dumps you into irb where you can inspect variables, etc. but you can also drop down another level to see the call hierarchy, etc.</li> </ul> <p>So when will we see Rails 2.0? The preview release is coming, hopefully before conference end.</p>