class Plume < ActiveRecord::Base belongs_to :image_file has_many :plume_cats has_many :plume_articles, :through => :plume_cats has_many :plume_events def v_une_1 cat = self.plume_cats.where(:title => "édito").first if cat return cat.plume_articles.first else return nil end end def v_une_2 cat = self.plume_cats.where(:title => "Dossier").first if cat return cat.plume_articles.first else return nil end end def v_une_3 cat = self.plume_cats.where(:title => "Grain de sable").first if cat return cat.plume_articles.first else return nil end end end