Skip to content

Instantly share code, notes, and snippets.

View alexandrebini's full-sized avatar

Alexandre Bini alexandrebini

View GitHub Profile
module WillPaginateHack
def self.included(base)
base.alias_method_chain :url, :hack
end
private
def url_with_hack(page)
if page > 1
url_without_hack(page)
else
# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
#
# Andre Lewis 1/2010
# encoding: utf-8
# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
#
# Andre Lewis 1/2010
# encoding: utf-8
require "config/environment.rb"
namespace :carrierwave do
task :destroy, :class, :mount_uploader, :version do |task,args|
desc "Destroy one image version"
eval(args[:class]).all.each do |r|
r.instance_eval(args[:mount_uploader].to_sym).instance_eval(args[:version].to_sym).remove!
end
end
<%= content_for(:javascript) do %>
<%= javascript_tag "save_related_category_src(#{@category.categories.any?})"%>
<%- for category in @category.categories do %>
<%= javascript_tag "add_new_related_category(#{category.id})" %>
<% end %>
<% end %>