This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Spree extension capistrano tasks | |
# -------------------------------- | |
# by Christopher Maujean | |
# | |
# These tasks depend on the existence of the extensions hash. | |
# The key is name of the directory in vendor/extensions. | |
# The value is the git url of the extension. | |
# | |
# set :extensions, { | |
# 'my_site' => "[email protected]:/username/spree-my-site.git" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# class Foo < Tableless | |
# column :bar, :string | |
# column :baz, :datetime | |
# validates_presence_of :bar, :baz | |
# end | |
class Tableless < ActiveRecord::Base | |
def self.columns | |
@columns ||= []; | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Must be run in the context of your rails app | |
# if you put this in a rake task, you'll need to ensure the task depends on the :environment task | |
require 'rails/generators' | |
require "#{::Rails.root.to_s}/lib/generators/foo_bar/article/article_generator.rb" | |
# make a generator (new calls .shift on the first arg, so it must be looking for an array) | |
gen = FooBar::ArticleGenerator.new(["Der title of der article"]) | |
# run your create_ methods here: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- | |
Wine & Spirits: | |
- | |
Beer: [] | |
- | |
Wine: | |
- Red | |
- White | |
- Blush |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Regenerates a rails 3 app for testing" | |
task :test_app do | |
SPREE_PATH = ENV['SPREE_PATH'] | |
raise "SPREE_PATH should be specified" unless SPREE_PATH | |
require File.join(SPREE_PATH, 'lib/generators/spree/test_app_generator') | |
class FlagPromotionTestAppGenerator < Spree::Generators::TestAppGenerator | |
def tweak_gemfile | |
append_file 'Gemfile' do | |
<<-gems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /blog/ | |
RedirectMatch 301 ^/(.*)/$ http://www.example.com/blog/$1 | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
Options +FollowSymLinks | |
<Directory /path/to/the/Blog> | |
Options +Indexes FollowSymLinks +ExecCGI | |
AllowOverride AuthConfig FileInfo | |
Order allow,deny | |
Allow from all | |
</Directory> | |
Redirect /blog http://www.example.com/Blog | |
ProxyRequests Off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "xpath" # XPath is a separate gem now | |
module Cucumber | |
module Rails | |
module CapybaraSelectDatesAndTimes | |
def select_date (date, options = {}) | |
date = Date.parse(date) | |
# lookup id prefix by label | |
id_prefix = id_prefix_for(options[:label]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bar < ActiveRecord::Base | |
acts_as_nested_set :dependent => :destroy | |
belongs_to :foo | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Content Manager | |
# – can access overview, reports, events, faq, snippets, and pages. | |
class ContentAbility | |
include CanCan::Ability | |
def initialize(user) | |
if user.has_role?(:content) | |
can :manage, :all | |
cannot :manage, Product | |
cannot :manage, Configuration |
OlderNewer