mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-12 16:34:18 +00:00
first commit of a million rails snippets, conditions missing, command implementation missing...
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Create controller class
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:Model}Controller < ApplicationController
|
||||
before_filter :find_${2:model}
|
||||
|
||||
$0
|
||||
|
||||
private
|
||||
def find_${2}
|
||||
@$2 = ${3:$1}.find(params[:id]) if params[:id]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: flash
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: flash[…]
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
flash[:${1:notice}] = "${2:Successfully created...}"$0
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: verify
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: verify — render
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
verify :only => [:$1], :method => :post, :render => {:status => 500, :text => "use HTTP-POST"}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: verify
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: verify — redirect
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
verify :only => [:$1], :session => :user, :params => :id, :redirect_to => {:action => '${2:index}'}
|
||||
Reference in New Issue
Block a user