Created
September 2, 2010 21:51
-
-
Save dariocravero/563016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wakupdude.controllers :dudes do | |
set :haml, {:format => :html5 } | |
# get :index do | |
# render "dudes/index" | |
# end | |
get :all, :map => "/" do | |
@dudes = Dude.all() | |
render "dudes/list" | |
end | |
get :read, :map => "/", :with => :id do | |
@dude = Dude.find_by_id(params[:id]) | |
render "dudes/read" | |
end | |
get :create, :map => "/create" do | |
render "dudes/create" | |
end | |
post :create, :map => "/" do | |
params.inspect | |
@dude = Dude.new(params[:dude]) | |
if @dude.save | |
# flash[:notice] = 'The dude was successfully created.' | |
redirect url(:dudes, :read, :id => @dude.id) | |
else | |
redirect url(:dudes, :all) | |
end | |
end | |
delete :delete, :map => "/", :with => :id do | |
@dude = Dude.find_by_id(params[:id]) | |
@dude.destroy | |
redirect url(:dudes, :all) | |
end | |
post :update, :with => :id do | |
@dude = Dude.find_by_id(params[:id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment