Skip to content

Commit

Permalink
Get shouts displaying after polymorphic refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed Mar 12, 2012
1 parent 1a69767 commit d1ddefe
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions app/models/shout.rb
@@ -1,9 +1,7 @@
class Shout < ActiveRecord::Base
belongs_to :user
belongs_to :medium, polymorphic: true

def current

end
def self.current
order("created_at DESC")
end
Expand Down
1 change: 1 addition & 0 deletions app/models/text_shout.rb
@@ -1,2 +1,3 @@
class TextShout < ActiveRecord::Base
has_one :shout, as: :medium
end
4 changes: 0 additions & 4 deletions app/views/dashboards/show.html.erb
@@ -1,10 +1,6 @@
<h1>Dashboard</h1>
Welcome <%= current_user.email %> - <%= link_to "Sign out", sign_out_path, method: :delete %>

<%= form_for(@shout) do |form| %>
<%= form.text_field :body, placeholder: "Shout here" %>
<%= form.submit "Shout!" %>
<% end %>

<div id="shouts">
<%= render @shouts %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/shouts/_shout.html.erb
@@ -1,3 +1,4 @@
<%= content_tag_for(:div, shout) do %>
<%= link_to shout.body, shout %> <%= time_ago_in_words(shout.created_at) %> ago
<%= render shout.medium %>
<%= time_ago_in_words(shout.created_at) %> ago
<% end %>
1 change: 1 addition & 0 deletions app/views/text_shouts/_text_shout.html.erb
@@ -0,0 +1 @@
<%= link_to text_shout.body, text_shout.shout %>

0 comments on commit d1ddefe

Please sign in to comment.