mirror of
https://github.com/amix/vimrc
synced 2025-07-19 18:14:59 +08:00
merge
This commit is contained in:
@ -36,7 +36,7 @@ snippet crw
|
||||
cattr_accessor :${0:attr_names}
|
||||
snippet defcreate
|
||||
def create
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new($1_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @$1.save
|
||||
@ -95,7 +95,7 @@ snippet defupdate
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @$1.update_attributes(params[:$1])
|
||||
if @$1.update($1_params)
|
||||
flash[:notice] = '$2 was successfully updated.'
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { head :ok }
|
||||
@ -105,6 +105,10 @@ snippet defupdate
|
||||
end
|
||||
end
|
||||
end
|
||||
snippet defparams
|
||||
def ${1:model_class_name}_params
|
||||
params.require(:$1).permit()
|
||||
end
|
||||
snippet dele delegate .. to
|
||||
delegate :${1:methods}, to: :${0:object}
|
||||
snippet dele delegate .. to .. prefix .. allow_nil
|
||||
@ -321,7 +325,7 @@ snippet xpost
|
||||
snippet xput
|
||||
xhr :put, :${1:update}, id: ${2:1}, ${3:object}: ${4:object}
|
||||
snippet test
|
||||
test 'should ${1:do something}' do
|
||||
test '${1:should do something}' do
|
||||
${0}
|
||||
end
|
||||
###########################
|
||||
@ -344,7 +348,7 @@ snippet mct
|
||||
${0}
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
|
||||
def up
|
||||
${0}
|
||||
end
|
||||
@ -353,7 +357,7 @@ snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. en
|
||||
end
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def change .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
|
||||
def change
|
||||
${0}
|
||||
end
|
||||
|
Reference in New Issue
Block a user