Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Created October 30, 2011 15:48
Show Gist options
  • Save amacgregor/1326046 to your computer and use it in GitHub Desktop.
Save amacgregor/1326046 to your computer and use it in GitHub Desktop.
Controller
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