Created
October 30, 2011 15:48
-
-
Save amacgregor/1326046 to your computer and use it in GitHub Desktop.
Controller
This file contains hidden or 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
Crow.controllers :sites do | |
get :index do | |
@sites = Site.all(:order => 'name') | |
render 'sites/index' | |
end | |
get :show, :with => :id do | |
@site = Site.get(params[:id]) | |
render 'sites/show' | |
end | |
get :new do | |
@site = Site.new | |
@servers = Server.all | |
render 'sites/new' | |
end | |
post :create do | |
@site = Site.new(params[:site]) | |
if @site.save | |
flash[:notice] = 'Site was successfully created.' | |
redirect url(:sites, :edit, :id => @site.id) | |
else | |
render 'sites/new' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment