diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index ebb571e..b9cdfb9 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -555,7 +555,7 @@ snippet pry ############################################# # Rails snippets - for pure Ruby, see above # -############################################# +############################################# snippet art assert_redirected_to ${1::action => "${2:index}"} snippet artnp @@ -589,7 +589,7 @@ snippet crw snippet defcreate def create @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) - + respond_to do |wants| if @$1.save flash[:notice] = '$2 was successfully created.' @@ -605,7 +605,7 @@ snippet defdestroy def destroy @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) @$1.destroy - + respond_to do |wants| wants.html { redirect_to($1s_url) } wants.xml { head :ok } @@ -618,7 +618,7 @@ snippet defedit snippet defindex def index @${1:model_class_name} = ${2:ModelClassName}.all - + respond_to do |wants| wants.html # index.html.erb wants.xml { render :xml => @$1s } @@ -627,7 +627,7 @@ snippet defindex snippet defnew def new @${1:model_class_name} = ${2:ModelClassName}.new - + respond_to do |wants| wants.html # new.html.erb wants.xml { render :xml => @$1 } @@ -636,7 +636,7 @@ snippet defnew snippet defshow def show @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - + respond_to do |wants| wants.html # show.html.erb wants.xml { render :xml => @$1 } @@ -645,7 +645,7 @@ snippet defshow snippet defupdate def update @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - + respond_to do |wants| if @$1.update_attributes(params[:$1]) flash[:notice] = '$2 was successfully updated.' @@ -776,15 +776,15 @@ snippet sha1 snippet sweeper class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper observe $1 - + def after_save(${2:model_class_name}) expire_cache($2) end - + def after_destroy($2) expire_cache($2) end - + def expire_cache($2) expire_page end @@ -893,7 +893,7 @@ snippet migration def self.up ${2} end - + def self.down end end @@ -923,10 +923,10 @@ snippet cont ${2} end snippet bef - before(:${1:each}) do + before :${1:each} do ${2} end snippet aft - after(:${1:each}) do + after :${1:each} do ${2} end