Skip to content
Browse files

Who needs silly JavaScript foo when you can redirect super fast and b…

…e all lazy-like.
  • Loading branch information...
1 parent 366d02c commit 54aa0109cc4ab9874394d0b5e564f3b6827b671d @olivierlacan committed May 15, 2012
Showing with 8 additions and 19 deletions.
  1. +1 −12 app/assets/javascripts/gifs.js.coffee
  2. +7 −7 app/controllers/gifs_controller.rb
View
13 app/assets/javascripts/gifs.js.coffee
@@ -1,14 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
-
-$ ->
- reloadIndex = ->
- console.log "fired reloadIndex"
-
- $.getJSON
- url: '/gifs.json'
- success: (response) ->
- console.log "woot"
-
- $("#new_gif").on "ajax:success", reloadIndex
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
View
14 app/controllers/gifs_controller.rb
@@ -17,11 +17,11 @@ def new
def create
@gif = Gif.new(params[:gif])
if @gif.save
- flash[:notice] = "Win!"
- respond_with @gif
+ flash[:notice] = "Wee!"
+ redirect_to gifs_url
else
- flash[:error] = "Um, failed. Lame."
- render :new
+ flash[:error] = "Um, lame."
+ redirect_to gifs_url
end
end
@@ -32,10 +32,10 @@ def edit
def update
@gif = Gif.find(params[:id])
if @gif.update_attributes(params[:gif])
- flash[:notice] = "Win!"
- respond_with @gif
+ flash[:notice] = "Wee!"
+ redirect_to gifs_url
else
- flash[:error] = "Nope."
+ flash[:error] = "Nope. Noooope!"
render :edit
end
end

0 comments on commit 54aa010

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