今さらながら、map.resources を触りだしました。
Rails 2.0 だと map.resources で has_many が使えるようなのですが、
map.resources :articles, :has_many => [ [:comments, {:controller => :article_comments}] ]
のように controller を指定するには
--- /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3.7707/lib/action_controller/resources.rb 2007-10-02 11:40:29.000000000 +0900 +++ resources.rb 2007-10-03 18:59:47.000000000 +0900 @@ -426,7 +426,9 @@ name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" Array(options[:has_many]).each do |association| - resources(association, :path_prefix => path_prefix, :name_prefix => name_prefix, :namespace => options[:namespace]) + assoc, opts = Array(association) + opts ||= {} + resources(assoc, opts.merge(:path_prefix => path_prefix, :name_prefix => name_prefix, :namespace => options[:namespace])) end Array(options[:has_one]).each do |association|
でいいのかなぁ。
あ、でもネストできるんだから、無理に has_many で書かなくても
map.resources :articles do |article| article.resources :comments, :controller => :article_comments end
でいいのか。
mixi の画面が白すぎて見づらいので、Stylish で目にやさしそうな感じにしてみました。
完成にはほど遠いのですが、自分が満足したのでこれでとりあえず終了。
@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain("mixi.jp") { body { background-color: #fcfae9 !important; } .listBox01 div.contents{ background-color: #f7f1cf !important; } .listBoxUtility01 { background-color: #f8d88c !important; } #bodyContents div.heading02 { background-image: url(http://img.mixi.jp/img/basic/heading/body_main_area001.gif) !important; } #bodyContents div.contents { background-color: #f7f1cf !important; border: solid 1px #f8d88c !important; } #bodyMainArea .groupList01 { background-color: #f7f1cf !important; background-image: none !important; } #bodyMainArea div.iconList03 ul li .iconState01 { background-color: #f7f1cf !important; } #communityIntro { background-color: #f7f1cf !important; border: solid 2px #f8d88c !important; } #communityMemberList .contents { padding: 0 !important; } #communityLinkList .contents { padding: 0 !important; } table.iconListTable { background: none !important; background-color: #f7f1cf !important; } table.iconListTable tr { background: none !important; } div.contents div.list_bottom { background-color: #f8d88c !important; margin: 0 !important; width: 268px !important; } div.list_bottom div.utilityLinks01 { margin-right: 0.5em !important; } div.titlebar02 { background-image: url(http://img.mixi.jp/img/basic/heading/body_side001.gif) !important; } dl.bbsList01 dd.bbsContent dl { background-image: none !important; background-color: #f3e4c8 !important; } dl.bbsList01 dd.bbsContent dl dd { background-color: #f7f1cf !important; padding-left: 1em !important; } dl.commentContent01 { background-image: none !important; background-color: #f3e4c8 !important; } dl.commentContent01 dd { background-color: #f7f1cf !important; padding-left: 1em !important; } div#profile ul { background-color: #f7f1cf !important; } div#profile ul li { background-image: none !important; border-bottom: solid 1px #f8d88c; padding-bottom: 0.4em; } div#profile ul li dl { background-image: none !important; } #intro div.contents dl dd { background-image: none !important; } div.txtconfirmArea { background-color: #f7f1cf !important; } .diaryHistory dd { background-color: transparent !important; } .txtEditArea { background-color: transparent !important; } object { display: none; } embed { display: none; } }