ミームの死骸を待ちながら

We are built as gene machines and cultured as meme machines, but we have the power to turn against our creators. We, alone on earth, can rebel against the tyranny of the selfish replicators. - Richard Dawkins "Selfish Gene"

We are built as gene machines and cultured as meme machines, but we have the power to turn against our creators.
We, alone on earth, can rebel against the tyranny of the selfish replicators.
- Richard Dawkins "Selfish Gene"

ハマったところなど

Rails公式サイトのアレに似た操作してると思ってください

<%= form_remote_tag :url => {:action => 'search'}, :update => ' photos' %>

の実行結果は、

をおいたとこに入る
あーダイアリ中でhtmlタグ認識しちゃうのか。どないしよ。うまい方法ありそうだけどとりあえず全角空白を入れてみる(逃げ)
スーパーpre記法」...あった。次からコードやタグはこれで書こう

flickr.rbのphotos method修正

106行目。まさかライブラリに手を入れようとは

def photos(*criteria)
photos = (criteria[0]) ? photos_search(criteria[0]) : photos_getRecent
if photos['photos']['photo'] == nil
return nil
end

photos['photos']['photo'].collect { |photo| Photo.new(photo['id']) }
end

これで、tag検索結果が0件の時nilが帰るようになったので、_photo.rhtmlの頭で

<% i f photo == nil %>
NO RESULT !
<%e lse%>…(以下通常)

とした。単純に。とりあえずのエラー画面回避。

謎のメモ

def source(size='Medium')
if sizez(size) == nil
return nil
sizes(size)['source']
end

ユーザいじる

取ってくる写真は連番なのでおなじユーザのものが多い。そこで重複を取り除きたいと思い試行錯誤。

flickr = Flickr.new 'KEY'
photo = flickr.photos( 検索条件 )

前にも述べたがphotoはArrayなので

photo[0].owner

Flickr::Userクラスのインスタンスが帰ってくる。