Skip to content

Instantly share code, notes, and snippets.

@skinnyjames
Created July 22, 2013 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skinnyjames/6055085 to your computer and use it in GitHub Desktop.
Save skinnyjames/6055085 to your computer and use it in GitHub Desktop.
#commit models
class Commit < ActiveRecord::Base
attr_accessible :commit_url, :author, :commit_message
set_inheritance_column :provider
end
class GithubCommit < Commit
end
#story model
class Story < ActiveRecord::Base
has_many :notes
has_many :commits
def activities
notes.zip(commits)
end
end
#view
<% story.activities.each do |activity| %>
<%= render :partial => "#{activity.class}" %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment