-
-
Save joshbuddy/563018 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, "/" do | |
@dudes = Dude.all() | |
render "dudes/list" | |
end | |
get :read, "/:id" do | |
@dude = Dude.find_by_id(params[:id]) | |
render "dudes/read" | |
end | |
get :create, "/create" do | |
render "dudes/create" | |
end | |
post :create, "/" 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, "/:id" do | |
@dude = Dude.find_by_id(params[:id]) | |
@dude.destroy | |
redirect url(:dudes, :all) | |
end | |
post :update, "/post/: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