Skip to content
Browse files

Merge branch 'master' of github.com:bavardage/quodit

  • Loading branch information...
2 parents e3d8eb0 + dd810be commit 9d4f6b14c95a2eafd8f58feb4f68c83150cd515a @bavardage committed
Showing with 23 additions and 0 deletions.
  1. +2 −0 app/controllers/home_controller.rb
  2. +15 −0 app/controllers/quotes_controller.rb
  3. +6 −0 app/views/quotes/new.html.erb
View
2 app/controllers/home_controller.rb
@@ -1,4 +1,6 @@
class HomeController < ApplicationController
def index
+ if current_user
+ redirect_to current_user
end
end
View
15 app/controllers/quotes_controller.rb
@@ -5,4 +5,19 @@ def index
@quotes = @wall.quotes
end
+ def destroy
+
+ @quote = Quote.find(params[:id])
+ if (@quote.author == current_user)
+ @quote.destroy
+ end
+ respond_to do |format|
+ format.html { redirect_to(Wall.find(params[:wall_id]) }
+ end
+ end
+
+ def new
+ @wall = Wall.find(params[:wall_id])
+ @quote = Quote.new
+ end
end
View
6 app/views/quotes/new.html.erb
@@ -0,0 +1,6 @@
+<h1> Create new quote </h1>
+
+<% nested_form_for [@wall, @quote] do |f| %>
+<%= f.text_area :text %>
+<%= submit_tag "Save" %>
+<%= end %>

0 comments on commit 9d4f6b1

Please sign in to comment.
Something went wrong with that request. Please try again.