Ruby on Rails Tutorial (27)

朝練メモ。とりあえず view 側での使われかたについて。以下なあたりを再度確認。

$ find app |xargs grep will_paginate
app/views/users/show.html.erb:      <%= will_paginate @microposts %>
app/views/users/show_follow.html.erb:      <%= will_paginate %>
app/views/users/index.html.erb:<%= will_paginate %>
app/views/users/index.html.erb:<%= will_paginate %>
app/views/shared/_feed.html.erb:  <%= will_paginate @feed_items %>

どちらかというと表示させてみる方が良さげ。
ええと例えば app/views/users/index.html.erb ですが定義が以下。

<% provide(:title, 'All users') %>
<h1>All users</h1>

<%= will_paginate %>

<ul class="users">
  <%= render @users %>
</ul>

<%= will_paginate %>

これは何でしょう、って思っていたら <%= will_paginate %> で出力されているのは
will_paginate
なナニでした。成程。

app/views/layout 配下確認

以下なカンジなんですが

$ ls app/views/layouts 
application.html.erb  _footer.html.erb  _header.html.erb  _shim.html.erb

_shim て何だっけ。と思ったら application.html.erb から render されてて

<!DOCTYPE html>
<html>
  <head>
    <title><%= full_title(yield(:title)) %></title>
    <%= stylesheet_link_tag    "application", media: "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>
    <%= render 'layouts/shim' %>    
  </head>

IE 対策のソレでした。

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

むむ。つうか custom.css がどこで参照されているのかが分からない。テキスト的に 5.1.2 Bootstrap and custom CSS なあたりなのかどうか。bootstrap-sass という gem は一体何なのか。
確認しつつ何かあれば別途追記の方向。

追記

システムグローバルな CSS は app/assets/stylesheets/custom.css.scss なのかどうなのか。custom.css.scss の名前を xxx.css.scss にしてサーバ再起動してみたり。
で、アクセスしてみたんですが GET に行ってますね。

Started GET "/assets/xxx.css?body=1" for 127.0.0.1 at 2013-02-04 14:36:03 +0900
Served asset /xxx.css - 200 OK (9ms)

ちなみに app/assets/stylesheets 配下には

  • application.css
  • sessions.css.scss
  • static_pages.css.scss
  • users.css.scss
  • xxx.css.scss

があるんですが、全部 GET に行ってました。