Merge pull request #680 from andyw8/avoid-deprecated-rails

Avoid deprecated rails
This commit is contained in:
Louis Pilfold 2016-02-07 20:36:19 +00:00
commit 0b025c6afc

View File

@ -133,7 +133,7 @@ class ${1:Model}sController < ApplicationController
# PUT /${1/./\l$0/}s/1.xml # PUT /${1/./\l$0/}s/1.xml
def update def update
respond_to do |wants| respond_to do |wants|
if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}]) if @${1/./\l$0/}.update(params[:${1/./\l$0/}])
flash[:notice] = '${1:Model} was successfully updated.' flash[:notice] = '${1:Model} was successfully updated.'
wants.html { redirect_to(@${1/./\l$0/}) } wants.html { redirect_to(@${1/./\l$0/}) }
wants.xml { head :ok } wants.xml { head :ok }
@ -601,12 +601,6 @@ respond_to do |wants|
end end
endsnippet endsnippet
snippet resw "respond_with"
respond_with(${1:@${2:model}})${3: do |format|
format.${4:html} { $0 \}
end}
endsnippet
# FIXME # FIXME
snippet returning "returning do |variable| ... end" snippet returning "returning do |variable| ... end"
returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/} returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}
@ -799,10 +793,6 @@ snippet xput "xhr put"
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0 xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0
endsnippet endsnippet
snippet finl "find(:last)"
find(:last${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]})
endsnippet
snippet sweeper "Create sweeper class" snippet sweeper "Create sweeper class"
class ${1:Model}Sweeper < ActionController::Caching::Sweeper class ${1:Model}Sweeper < ActionController::Caching::Sweeper
observe ${1:Model} observe ${1:Model}