Skip to content

Commit

Permalink
authenticate user on edit and destroy, if current user for those meth…
Browse files Browse the repository at this point in the history
…ods in index page, lot of work to do, but thats necessary for now
  • Loading branch information
Kevin Quinn committed Jul 18, 2011
1 parent 086e230 commit 942d8d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/stories_controller.rb
@@ -1,6 +1,6 @@
class StoriesController < ApplicationController

before_filter :authenticate_user!, :only => [:rate]
before_filter :authenticate_user!, :only => [:rate, :edit, :destroy]

# GET /stories
# GET /stories.xml
Expand Down
7 changes: 4 additions & 3 deletions app/views/stories/index.html.erb
Expand Up @@ -17,11 +17,12 @@
<td><%= story.title %></td>
<td><%= story.content %></td>
<td><%= story.address %></td>
<td><%= story.geocoded? %></td>
<td><%= story.value %></td>
<td><%= link_to 'Show', story %></td>
<td><%= link_to 'Edit', edit_story_path(story) %></td>
<td><%= link_to 'Destroy', story, :confirm => 'Are you sure?', :method => :delete %></td>
<% if current_user %>
<td><%= link_to 'Edit', edit_story_path(story) %></td>
<td><%= link_to 'Destroy', story, :confirm => 'Are you sure?', :method => :delete %></td>
<% end %>
</tr>
<% end %>
</table>
Expand Down

0 comments on commit 942d8d9

Please sign in to comment.