projectionist: add
This commit is contained in:
parent
ee79ecdd44
commit
ebb04676b9
|
@ -0,0 +1,58 @@
|
||||||
|
---
|
||||||
|
title: Projectionist
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
```json
|
||||||
|
/* .projectionist.vim */
|
||||||
|
{
|
||||||
|
"app/assets/react/components/*.jsx": {
|
||||||
|
"type": "component",
|
||||||
|
"template": [
|
||||||
|
"import React from 'react'",
|
||||||
|
"export default {} = React.createClass({ ... })"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Available options
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"lib/*.rb": {
|
||||||
|
"type": "lib", /* enables :Elib */
|
||||||
|
"alternate": "test/{}_spec.rb", /* for :A */
|
||||||
|
"template": [ ... ],
|
||||||
|
|
||||||
|
"path": "include", /* for `gf` i think */
|
||||||
|
|
||||||
|
"console": "node", /* for :Console */
|
||||||
|
"dispatch": "node", /* for :Dispatch (dispatch.vim) */
|
||||||
|
"start": "rails server", /* for :Start (dispatch.vim) */
|
||||||
|
"make": "node", /* for makeprg */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
| Command | Description |
|
||||||
|
|---------|-------------|
|
||||||
|
| `:A` | Edit alternate |
|
||||||
|
| `:A {file}` | Edit file |
|
||||||
|
|---------|-------------|
|
||||||
|
| `:AS` | Edit in split |
|
||||||
|
| `:AV` | Edit in vsplit |
|
||||||
|
| `:AT` | Edit in tab |
|
||||||
|
|---------|-------------|
|
||||||
|
| `:AD` | Replace with template |
|
||||||
|
|---------|-------------|
|
||||||
|
| `:Cd` | cd to root |
|
||||||
|
| `:Cd {path}` | cd to path in root |
|
||||||
|
| `:Lcd` | cd to root using :lcd |
|
||||||
|
|---------|-------------|
|
||||||
|
| `:ProjectDo {cmd}` | run command in root |
|
||||||
|
{:.shortcuts}
|
||||||
|
|
||||||
|
### Reference
|
||||||
|
|
||||||
|
See [vim-projectionist](https://github.com/tpope/vim-projectionist).
|
|
@ -138,3 +138,13 @@ radio_button("post", "category", "java")
|
||||||
# <input type="radio" id="post_category_rails" name="post[category]"
|
# <input type="radio" id="post_category_rails" name="post[category]"
|
||||||
# value="rails" checked="checked" />
|
# value="rails" checked="checked" />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Reference
|
||||||
|
|
||||||
|
```rb
|
||||||
|
select(method, choices = nil, options = {}, html_options = {}, &block)
|
||||||
|
choices == [ ['label', id], ... ]
|
||||||
|
|
||||||
|
submit(value=nil, options={})
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -7,20 +7,39 @@ layout: default
|
||||||
|
|
||||||
```rb
|
```rb
|
||||||
items = Model
|
items = Model
|
||||||
.where(first_name: "Harvey")
|
.where(first_name: 'Harvey')
|
||||||
|
.where('id = 3')
|
||||||
|
.where('id = ?', 3)
|
||||||
|
|
||||||
.order(:title)
|
.order(:title)
|
||||||
.order(title: :desc)
|
.order(title: :desc)
|
||||||
.order("title DESC")
|
.order("title DESC")
|
||||||
|
|
||||||
.reorder(:title) # discards other .orders
|
.reorder(:title) # discards other .order's
|
||||||
.rewhere(...)
|
.rewhere(...) # discards other .where's
|
||||||
|
|
||||||
.limit(2)
|
.limit(2)
|
||||||
.offset(1)
|
.offset(1)
|
||||||
.uniq
|
.uniq
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Advanced:
|
||||||
|
|
||||||
|
```rb
|
||||||
|
.select(:id)
|
||||||
|
.select([:id, :name])
|
||||||
|
|
||||||
|
.group(:name) # GROUP BY name
|
||||||
|
.group('name AS grouped_name, age')
|
||||||
|
.having('SUM(price) > 30') # needs to be chained with .group
|
||||||
|
|
||||||
|
.includes(:user)
|
||||||
|
.includes(user: [:articles])
|
||||||
|
|
||||||
|
.references(:posts)
|
||||||
|
# .where("posts.name = 'foo'").references(:posts)
|
||||||
|
```
|
||||||
|
|
||||||
### [FinderMethods](http://devdocs.io/rails/activerecord/findermethods)
|
### [FinderMethods](http://devdocs.io/rails/activerecord/findermethods)
|
||||||
|
|
||||||
```rb
|
```rb
|
||||||
|
|
Loading…
Reference in New Issue