Skip to content

Instantly share code, notes, and snippets.

@CodeIQ
Forked from grooves/concern.rb
Created December 5, 2012 04:27
Show Gist options
  • Save CodeIQ/4212230 to your computer and use it in GitHub Desktop.
Save CodeIQ/4212230 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