Commit bfb55939
Changed files (4)
app
controllers
models
views
creations
layouts
app/controllers/favorites_controller.rb
@@ -9,7 +9,7 @@ class FavoritesController < ApplicationController
# POST /favorites
def create
- if( current_user == @creation.user )
+ if( current_user.owns @creation )
redirect_to @creation, :notice => "You can't favorite your own stuff"
return
end
app/models/creation.rb
@@ -39,4 +39,7 @@ class Creation < ActiveRecord::Base
logger.error e.backtrace.inspect
end
end
+ def is_owned_by(user)
+ @user == user
+ end
end
app/views/creations/show.html.erb
@@ -6,7 +6,7 @@
<h1>
<%= @creation.name %>
<small>
- <% if current_user.owns(@creation) %>
+ <% if @creation.user == current_user %>
<%= link_to '(edit)', edit_creation_path(@creation) %>
<%= link_to 'Delete', creation_path(@creation),:confirm => "Are you sure", :method => :delete, :class => 'btn btn-danger' %>
<% end %>
app/views/layouts/application.html.erb
@@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title><%= yield(:title) || "CakeSide" %></title>
<title>Welcome to CakeSide, a place for cake enthusiasts to share their proud creations!</title>
<meta name="description" content="">