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
# ruby
url_for
Get Full URL to Current Page
# ruby
url_for(:only_path => false)
Use Path Helpers in Class
# ruby
Rails.application.routes.url_helpers
which can be included in the class if desired.
To use Fonts In vendor/assets/fonts
# ruby
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/.
# ruby
Copyright ©
<% copyright = 2016..Date.today.year %>
<%= [copyright.min, copyright.max].uniq.join(' – ').html_safe %>
Last modified: 27 September 2016