This commit is contained in:
Rico Sta. Cruz 2012-03-16 14:40:21 +08:00
parent b72d65ddbd
commit d3823a12ec
3 changed files with 43 additions and 26 deletions

View File

@ -6,15 +6,8 @@
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1>Rails-routes</h1>
<h2>mapping</h2>
<p><a href="http://guides.rubyonrails.org/routing.html">Guides/Routing</a></p>
<p><a href="Rhttp://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper.html">ActionDispatch::Routing::Mapper</a>
(See included modules)</p>
<h3>Multiple resources</h3>
<h1>Rails Routes</h1>
<h3>Multiple resources</h3>
<pre><code>resources :books
# PhotosController:
@ -66,6 +59,17 @@ match 'photo/*path' =&gt; 'photos#unknown' # /photo/what/ever
match 'photos/:id' =&gt; 'photos#show', :defaults =&gt; { :format =&gt; 'jpg' }
</code></pre>
<h3>Get/post</h3>
<p><code>get</code> is the same as <code>match via: :get</code>.</p>
<pre><code>get 'photo/:id' =&gt; 'photos#show'
# same as match 'photo/:id' =&gt; 'photos#show', via: :get
post 'photo/:id' =&gt; 'photos#update'
# same as match 'photo/:id' =&gt; 'photos#show', via: :post
</code></pre>
<h3>Redirection</h3>
<pre><code>match '/stories' =&gt; redirect('/posts')
@ -189,6 +193,14 @@ root :to =&gt; 'welcome#index'
match ':controller(/:action(/:id(.:format)))'
</code></pre>
<h3>References</h3>
<ul>
<li><p><a href="http://guides.rubyonrails.org/routing.html">Guides/Routing</a></p></li>
<li><p><a href="http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper.html">ActionDispatch::Routing::Mapper</a>
(See included modules)</p></li>
</ul>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.4/jquery.min.js'></script>
<script src="http://cachedcommons.org/cache/prettify/1.0.0/javascripts/prettify-min.js"></script>

View File

@ -4,7 +4,7 @@ title: Cheat sheets
- Dir['./*.*'].each do |p|
- name = File.basename(p, '.*')
- ext = File.extname(p)
- next if %w[.sass .scss].include?(ext) || %w[config Gemfile index].include?(name) || name[0] == '_'
- next if %w[.sass .scss].include?(ext) || %w[config Gemfile Rakefile README index].include?(name) || name[0] == '_'
- url = name + ".html"
%li
%a{href: url}= name

37
tig.md
View File

@ -1,7 +1,12 @@
Tig shortcuts
-------------
Invocation
### Installing
$ brew install tig --HEAD
$ apt-get install tig
### Invocation
tig blame FILE
tig master # Show a branch
@ -9,24 +14,24 @@ Invocation
tig FILE # Show history of file
tig v0.0.3:README # Show contents of file in a specific revision
All views
---------
### All views
* `^N` - Next on parent view
* `^P` - Previous on parent view
^N # Next on parent view
^P # Previous on parent view
`m` - Main view
* `D` - Toggle between date display modes
* `A` - Toggle between author display modes
* `C` - Cherry pick a commit
### `m` - Main view
`S` - Stage view
D # Toggle between date display modes
A # Toggle between author display modes
C # Cherry pick a commit
* `u` - Stage/unstage file or chunk
* `!` - Revert file or chunk
* `C` - Commit
* `M` - Merge
### `S` - Stage view
`H` - Branch view
u # Stage/unstage file or chunk
! # Revert file or chunk
C # Commit
M # Merge
* `i` - Change sort header
### `H` - Branch view
i # Change sort header