In general, the Rails Routing from the Outside In guide is chock full of very useful information. It's a great reference for learning and remembering anything routes-related.
http://guides.rubyonrails.org/routing.html
A quick intro into how routes map a browser request (i.e., a url + a specific HTTP verb) to an operation within the Rails app by tying that route to a specific controller and a specific controller action.
http://guides.rubyonrails.org/routing.html#resources-on-the-web
This is a handy chart to understand. It shows the mapping between HTTP verbs (e.g., GET, POST), the URL segment (e.g., /feedback/new), and the controller + controller action (e.g., def new
). It's important to also look at and understand the conventions on when to use each (e.g., index
is typically a list view of the resource)
http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
When we created the resource routes for feedback, Rails provided us with a few URL helper methods. We used one of them (new_feedback_path
) inside our controller to redirect to the /feedback/new
URL. The URL helpers are nothing more than mappings to a route.
new_feedback GET /feedback/new(.:format) feedback#new
http://guides.rubyonrails.org/routing.html#path-and-url-helpers
Here is a link to a (very) old guide on routing. It talks in more detail about RESTful routes, how and why it's the default in Rails, and how it maps HTTP verbs, controllers, and controller actions. Ignore all of the routing syntax though. Unless you were to ever work on a very old Rails app, the syntax is entirely different.
http://guides.rubyonrails.org/v2.3.11/routing.html#restful-routing-the-rails-default
A few things that came up while working inside of the vim editor.
Assuming you don't use arrow keys for movement (You shouldn't; ask me why if you don't know), here's a bit of code you can add to your .vimrc
to use the arrow keys to instead manually resize windows.
https://github.com/emilford/dotfiles/blob/v3/.vimrc#L49
Of course it's handy to know how to use what's by default built in to vim. You can change window size using the following:
<ctrl-w> +/-
: increase/decrease height
<ctrl-w> >/<
: increase/decrease width
And if you want to add a default that lets you (mostly) forget about needing to resize windows, here's a handy snippet that causes vim to automatically rebalance windows whenever new windows are open.
https://github.com/emilford/dotfiles/blob/v3/.vimrc#L66
You can use <ctrl-w><ctrl-h>
and <ctrl-w><ctrl-j>
, left and down respectively, (there's also, ctrl-k
and ctrl-l
) to navigate between windows in vim, but given how often we need to jump between windows, that can quickly grow to be a bit cumbersome and slow to do. You can add the following lines to your .vimrc
so that <ctrl-h>
and <ctrl-j>
will navigate between windows.
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-h> <c-w><c-h>
But since you're wanting to use vim inside of tmux, I use and would suggest this plugin. It essentially defines for you the shortcuts I described above for inside of vim, but takes it a step further and intelligently navigates between tmux panes using the same shortcuts as well.