http://docs.ruby-lang.org/en/2.0.0/Hash.html

invert → new_hash
Returns a new hash created by using hsh's values as keys, and the keys as values. h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 }
h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"}
 <td class="recommend"><%= subchannel_item.if_recommend %></td>
  RECOMMEND = {
'否' => false,
'是' => true
}
  def if_recommend
RECOMMEND.invert[recommend]
end
[11] pry(main)> SubchannelItem::RECOMMEND
=> {"否"=>false, "是"=>true}
[12] pry(main)> SubchannelItem::RECOMMEND.invert
=> {false=>"否", true=>"是"} [15] pry(main)> SubchannelItem::RECOMMEND.invert[SubchannelItem.first.recommend]
=> "是"
05-11 18:38