Skip to content

Instantly share code, notes, and snippets.

@flada-auxv
Forked from CodeIQ/concern.rb
Created December 19, 2012 10:22
Show Gist options
  • Save flada-auxv/4335767 to your computer and use it in GitHub Desktop.
Save flada-auxv/4335767 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.count
= pub.publication_comments.count
# 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
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment