Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Forked from CodeIQ/concern.rb
Created December 18, 2012 05:00
Show Gist options
  • Save hokaccha/4325160 to your computer and use it in GitHub Desktop.
Save hokaccha/4325160 to your computer and use it in GitHub Desktop.
# coding: utf-8
class Concern < ActiveRecord::Base
belongs_to :publication
end
- @publications.each do |pub|
= pub.concerns.size
= pub.publication_comments.size
# coding: utf-8
class Publication < ActiveRecord::Base
has_many :concerns
has_many :publication_comments
end
# coding: utf-8
class PublicationComment < ActiveRecord::Base
belongs_to :publication
end
# coding: utf-8
class PublicationsController < ApplicationController
def index
@publications = Publication.all(:include => [:concerns, :publication_comments])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment