class Groups < Application # provides :xml, :yaml, :js def index @groups = Group.all display @groups end def show @group = Group.get(params[:id]) raise NotFound unless @group display @group end def new only_provides :html @group = Group.new render end def edit only_provides :html @group = Group.get(params[:id]) raise NotFound unless @group render end def create @group = Group.new(params[:group]) puts @group.valid? puts @group.errors.inspect if @group.save redirect url(:group, @group) else puts "Re-rendering the new template" render :new end end def update @group = Group.get(params[:id]) raise NotFound unless @group if @group.update_attributes(params[:group]) || !@group.dirty? redirect url(:group, @group) else raise BadRequest end end def destroy @group = Group.get(params[:id]) raise NotFound unless @group if @group.destroy redirect url(:group) else raise BadRequest end end end # Groups