Linked List

A personal knowledge base

Rails

#Index Scopes and Associations With ctags

Exuberant ctags indexes source code so you can jump directly to definitions within editors such as vim that support tags files. Add the following to ~/.ctags to get it to index rails scopes and associations:

--regex-ruby=/^[ \t]*scope[ \t]*:([a-zA-Z0-9_]+)/\1/s,scopes/
--regex-ruby=/^[ \t]*(has_many|has_one|belongs_to)[ \t]*:([a-zA-Z0-9_]+)/\2/a,associations/

#Copy Sample File

See Shell Snippets page.

#Get Path to Current Page

url_for

#Get Full URL to Current Page

url_for(:only_path => false)

#Use Path Helpers in Class

Rails.application.routes.url_helpers

which can be included in the class if desired.

#To use Fonts In vendor/assets/fonts

Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/

#Dynamic Footer Year

To automatically update your website copyright to the current year. See also http://updateyourfooter.com/.

Copyright &copy;
<% copyright = 2016..Date.today.year %>
<%= [copyright.min, copyright.max].uniq.join(' &ndash; ').html_safe %>
Last modified: 28 Sep 2016