Skip to content

Instantly share code, notes, and snippets.

View pwanderson's full-sized avatar

Patrick Anderson pwanderson

View GitHub Profile
@pwanderson
pwanderson / formtastic_extentions.rb
Created January 5, 2012 22:34 — forked from rhulse/formtastic_extentions.rb
Formtastic 2.0 custom input upgrade examples
# This file contains custom input method from formtastic 1.2 and their
# replacement classes in 2.0
module FormtasticExtensions
class WysiwygInput < Formtastic::Inputs::TextInput
def input_html_options
wysiwyg_type = input_options.delete(:controls)
@pwanderson
pwanderson / ability.rb
Created November 4, 2011 23:55 — forked from watson/ability.rb
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /