Some JavaScript
// Delete confirmation modals
$('#delete-confirm').on('show', function() {
var $submit = $(this).find('.btn-danger'),
href = $submit.attr('href');
$submit.attr('href', href.replace('pony', $(this).data('id')));| #Add in your project in config/initializers/will_paginate.rb | |
| #in my case I'm adding the attribute page_number with value of target | |
| WillPaginate::ActionView::LinkRenderer.class_eval do | |
| def link(text, target, attributes = {}) | |
| attributes.merge!(page_number: "#{target}") | |
| super text, target, attributes | |
| end | |
| end |
| # Paginate a collection | |
| # | |
| # Usage: | |
| # | |
| # {% paginate contents.projects by 5 %} | |
| # {% for project in paginate.collection %} | |
| # {{ project.name }} | |
| # {% endfor %} | |
| # {% endpaginate %} | |
| # |
This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.
# Ensure system is in ship-shape.
aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev
| #First you need to copy password_salt and encrypted_password to your new object model | |
| #Using this because I have to export my database User to another application and old, | |
| # app are using devise 1.0.x and new app using 2.1.x | |
| Class User < ActiveRecord::Base | |
| alias :devise_valid_password? :valid_password? | |
| def valid_password?(password) | |
| begin |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Cmd+↩ | insert line after |