Skip to content

Instantly share code, notes, and snippets.

@CodeIQ
Forked from grooves/concern.rb
Created December 7, 2012 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save CodeIQ/4230117 to your computer and use it in GitHub Desktop.
Save CodeIQ/4230117 to your computer and use it in GitHub Desktop.
Question 1
# 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