Skip to content

Commit

Permalink
Added shouts#show
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed Mar 12, 2012
1 parent b01b4c3 commit e5187ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/shouts_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,8 @@
class ShoutsController < ApplicationController class ShoutsController < ApplicationController
def show
@shout = Shout.find(params[:id])
end

def create def create
shout = current_user.shouts.new(params[:shout]) shout = current_user.shouts.new(params[:shout])
shout.save shout.save
Expand Down
2 changes: 1 addition & 1 deletion app/views/shouts/_shout.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= content_tag_for(:div, shout) do %> <%= content_tag_for(:div, shout) do %>
<%= shout.body %> <%= time_ago_in_words(shout.created_at) %> ago <%= link_to shout.body, shout %> <%= time_ago_in_words(shout.created_at) %> ago
<% end %> <% end %>
2 changes: 2 additions & 0 deletions app/views/shouts/show.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= link_to "Back", :back %>
<%= render @shout %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
Shouter::Application.routes.draw do Shouter::Application.routes.draw do
root to: "welcome#index" root to: "welcome#index"
resource :dashboard, only: [:show] resource :dashboard, only: [:show]
resources :shouts, only: [:create] resources :shouts, only: [:create, :show]
end end

0 comments on commit e5187ed

Please sign in to comment.