惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Heimdal Security Blog
P
Privacy International News Feed
S
Schneier on Security
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Spread Privacy
Spread Privacy
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
aimingoo的专栏
aimingoo的专栏
Simon Willison's Weblog
Simon Willison's Weblog
S
Securelist
Help Net Security
Help Net Security
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Archives - TechRepublic
Security Archives - TechRepublic
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
雷峰网
雷峰网
博客园 - 司徒正美
V
V2EX
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
N
News | PayPal Newsroom
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
PCI Perspectives
PCI Perspectives
Google DeepMind News
Google DeepMind News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
U
Unit 42
C
Cybersecurity and Infrastructure Security Agency CISA
P
Palo Alto Networks Blog
G
Google Developers Blog
T
Threat Research - Cisco Blogs
博客园 - Franky
I
InfoQ
D
DataBreaches.Net
爱范儿
爱范儿
Y
Y Combinator Blog
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Ruby on Rails: Compress the complexity of modern web apps

Safer to_i coercion, custom to_fs formats, and more! This Week in Rails: May 16, 2026 This Week in Rails: May 8, 2026 This Week in Rails: May 1, 2026 Active Record gets better every week Great big Rails World 2026 update: CFP, Corporate Support tickets, workshops Query command for database queries and more Explicit query: and body: kwargs for integration tests and more! Speedup ActiveRecord::LogSubscriber#sql_color and more! This Week in Rails: March 27, 2026 Rails Versions 8.0.5 and 8.1.3 have been released! Rails Versions 7.2.3.1, 8.0.4.1, and 8.1.2.1 have been released! This Week in Rails: March 20, 2026 Validate URI scheme in Action Text and more This Week in Rails: March 6, 2026 Planning Center is the newest Rails Foundation Contributing member Action Text gets Markdown conversion, editor links in devcontainers, and more! BARRA seeks Rails developer Joe Agliozzo is looking for a Rails developer The rise of lighttpd as the alternative web server When longer is better and more is more Snowdevil: First e-tailer on Rails Natural selection for frameworks in Ruby vs Java Address book tutorial in Portuguese Becoming a better programmer with Rails 10 Things Every Java Programmer Should Know About Ruby Really Getting Started in Rails Off the Treadmill, Onto the Rails Rails 0.9.5: A world of fixes and tweaks Rich clients with Rails and XUL Pedrosa on Rails vs WebWork: 'Language DOES matter' 'Ruby on Rails is unbelievably good' Celebrating six months anniversary! Speeding up CGI access to Gem Rails CD Baby leaves PHP behind for Ruby on Rails "I think Ruby on Rails is way over hyped" Programmer needed for JSP to Rails conversion Beyond the 10,000th gem install of Rails 'That application is so stupid' Matz takes note of Ta-da and Rails Rails tutorial on O'Reilly's ONLamp Welcome Slashdotters! Ta-da goes international with UTF-8 Make your Ta-da list today Rails 0.9.4.1: Cleaning up the mess Rails 0.9.4: Caching, filters, SQLite3... An unusual high presence of Macs Having problems running tests under 1.8.2? It\'s all about the applications But what does Rails go web services with XML-RPC prototype Rails runs through XP Cincinnati RedHanded out-evangelizes the evangelizer Rails on Lighttpd with FastCGI Have a codefest and collect cash from RubyCentral Jamis Buck is working on Basecamp S5 Presents competes with SoapBX 3,000 people are doing 10,804 things... Using the Rails to impress potential employers Brian discovers the default logging goodness SoapBX: Presentations powered by S5, Textile, Rails Road Map: The rails leading to 1.0 Tracks: A Getting Things Done implementation Nicholas presents the Directors Rails 0.9.3: Optimistic locking, dynamic finders, 1.8.2 Ruby on the German Rails 43things in 5,204 lines of Ruby on Rails Watch for huge requests on default FCGI How the redesign of the website came to be Are you watching the health of your software? "Some amazing web apps appear on Ruby on Rails" Learning Ruby on Rails with 43things The Robot Co-op takes 43things.com live! Giving up on Java for lack of love Setting up EliteJournal on TextDrive without a vhost Celebrating 219 applied patches since 0.7 Escaping Java but not its thinking "Simple design that even my grandma can understand" Rails logo remixed by Olivier Hericord Rake 0.4.14 includes fix for Ruby 1.8.2 Splitting off the research patches Running rake tests with Ruby 1.8.2 Marten opens Epilog for Trac'ing Drew McLellan predicts Rails celebrates more than 10,000 downloads Variations on a railed theme Securing your Rails: Keep it secret, keep it safe Available for hire? Collaboa and EliteJournal joins the Trac Playing Active Records on MS SQLServer and DB2 Open sourcing the Rails logo Rails: Technology of the Year #1 Reacting to customer requests in real time Extracting missing content from wiki backups Ruby on Rails has its web presence overhauled 43 things makes The Seattle Times 5.gets David Heinemeier Hansson Ruby 1.8.2 finally sees the light of day Rails 0.9: Fast development, breakpoints, validations Rails 0.9.1: Small, but important bugfix for Action Pack
Rails 1.2 RC1: New in Action Pack
David Heinemeier Hansson · 2006-11-26 · via Ruby on Rails: Compress the complexity of modern web apps

Sunday, November 26, 2006
Posted by josh

With all respect to the reporter from the Edge, here are a few tasty bits from ActionPack in Rails 1.2 (CHANGELOG). (compiled by Geoffrey Grosenbach).

<h1>Views</h1>


<p>You can now access nested attributes in <span class="caps">RJS</span>:</p>


<pre><code>page['foo']['style']['color'] = 'red' # =&gt; $('foo').style.color = 'red';</code></pre>


<p>Forms now use blocks instead of <code>end_form_tag</code> (<a href="http://www.loudthinking.com/arc/000601.html">notes from <span class="caps">DHH</span></a>):</p>

<% form_tag(products_url) do %>
  <%= text_field :product, :title %>
  <%= submit_tag "Save" %>
<% end -%>
<p>And how many blogs have you visited that say &#8220;Last updated 60 days ago&#8221;? Years and months have been added to <code>distance_of_time_in_words</code>, so you&#8217;ll see &#8220;2 months ago&#8221; or maybe even &#8220;5 years ago&#8221; now.</p>


<h1>Controllers</h1>


<p>Uncaught exceptions raised anywhere in your application will cause <code>RAILS_ROOT/public/500.html</code> to be read and shown instead of just the static &#8220;Application error (Rails).&#8221; So make it look nice if you aren&#8217;t using it already!</p>


<p>There is a new <code>head(options = {})</code> method for responses that have no body.</p>


<pre><code>head :status =&gt; 404 # return an empty response with a 404 status head :location =&gt; person_path(@person), :status =&gt; 201</code></pre>


<p>You can declare specific file extensions exempt from layouts. Bring on the <span class="caps">CSS</span>, PDF, and graphic generating plugins!</p>


<pre><code>ActionController::Base.exempt_from_layout 'rpdf'</code></pre>


<p>RESTful resources automatically get a <code>params[:format]</code> option that can force a content type. If :format is specified and matches a declared extension, that mime type will be used in preference to the &#8220;Accept&#8221; header. This means you can link to the same action from different extensions and use that fact to determine output (<a href="http://nubyonrails.com/articles/2006/10/09/peepcode-rest-basics">cheat sheet</a>).</p>


<pre><code>class WeblogController &lt; ActionController::Base   def index
@posts = Post.find :all
respond_to do |format|
  format.html
  format.xml { render :xml =&gt; @posts.to_xml }
  format.rss { render :action =&gt; "feed.rxml" }
end   end</code></pre>


<p>You can also register your own custom <span class="caps">MIME</span> types. These will be automatically incorporated into controllers so you can use them in <code>respond_to</code> blocks and as file <code>:format</code> extensions.</p>


<pre><code>Mime::Type.register(string, symbol, synonyms = []) Mime::Type.register("image/gif", :gif)</code></pre>


<p>Finally, <code>ActionController.filter_parameter_logging</code> makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled.</p>


<pre><code>filter_parameter_logging 'password' # Don't log fields that match 'password'</code></pre>


<h1>Routing and URLs</h1>


<p>Routing has been significantly rewritten for speed and consistency. One of the benefits is that you can use named routes and RESTful routes in your mailer templates.</p>

class MyMailer < ActionMailer::Base

  include ActionController::UrlWriter
  default_url_options[:host] = 'my_site.com'
<h1>Testing</h1>

assert_response now supports additional symbolic status codes.


  assert_response :success # You know this one
  assert_response :ok
  assert_response :not_found
  assert_response :forbidden
<p>Added the rulin&#8217; <code>assert_select</code> for <span class="caps">CSS</span> selector-based testing (<a href="http://blog.labnotes.org/2006/09/04/assert_select-cheat-sheet/">cheat sheet</a>). Use this instead of <code>assert_tag</code> from now on. </p>


<pre><code>assert_select "a[href=http://assert_select_rules.com]", @item.url, "Should have a link"  assert_select "div#products", nil, "Should show a products div on the page"</code></pre>


<h1>Deprecated</h1>


<p>You&#8217;ll see warnings when you run your test suite. Here are a few that have been replaced with better syntax:</p>


<ul>
<li>assert_tag &rarr; assert_select</li>
</ul>


<ul>
<li>start_form_tag and end_form_tag &rarr; form_tag do end</li>
</ul>


<ul>
<li>@cookies, @headers, @request, @response, @params, @session, @flash &rarr; cookies, headers, request, response, params, session, flash</li>
</ul>


<ul>
<li>.png is no longer automatically appended to extension-less <code>image_tag</code> calls</li>
</ul>