This file contains 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
def link_type_sprite(image, options = {}) | |
sprites = { | |
ReferrerClassifier::FACEBOOK => {:w => 20, :h => 20, :x => 5, :y => 0}, | |
ReferrerClassifier::TWITTER => {:w => 20, :h => 20, :x => 30, :y => 0}, | |
ReferrerClassifier::SEARCH => {:w => 20, :h => 20, :x => 55, :y => 0}, | |
ReferrerClassifier::BASIC => {:w => 20, :h => 20, :x => 80, :y => 0} | |
} | |
%(<div class="#{options[:class]}" style="background: url(#{path_to_image('/images/sn_icons/link-type-icon-sprite.png')}) no-repeat -#{sprites[image][:x]}px -#{sprites[image][:y]}px; width: #{sprites[image][:w]}px; height: #{sprites[image][:w]}px; #{options[:style]}" title="#{options[:title]}">#{options[:title]}</div>).html_safe | |
end |
This file contains 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
# in /config/devise.rb | |
... | |
# Configure the class responsible to send e-mails. | |
#config.mailer = "Devise::Mailer" | |
config.mailer = "MailerWithInfo" | |
... | |
# in /lib | |
class MailerInfo | |
def self.attributes=(attributes={}) |
This file contains 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
module DeviseMailerWithAttributes | |
class Devise::Mailer < ::ActionMailer::Base | |
alias_method :old_confirmation_instructions, :confirmation_instructions | |
alias_method :old_reset_password_instructions, :reset_password_instructions | |
alias_method :old_unlock_instructions, :unlock_instructions | |
alias_method :old_invitation_instructions, :invitation_instructions | |
def confirmation_instructions(record, attributes={}) | |
set_attributes(attributes) |
This file contains 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 'config/environment' | |
require 'mongo' | |
namespace :mongoid do | |
desc 'Update defaults' | |
task :defaults do | |
db = Mongoid.config.master | |
models.each do |m| | |
m = eval m |
This file contains 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
### subdomain_test.rb | |
require 'integration_test_helper' | |
class SubdomainTest < ActionController::IntegrationTest | |
test "simple subdomain test" do | |
sub1 = "sub1" | |
sub2 = "sub2" | |
# this test passes using selenium | |
#Capybara.current_driver = :selenium |
This file contains 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
# /test/integration/subdomain_test.rb | |
require 'integration_test_helper' | |
class SubdomainTest < ActionController::IntegrationTest | |
test "simple subdomain test" do | |
subdomain = "something" | |
# this test passes using selenium, fails using the default envjs | |
#Capybara.current_driver = :selenium | |
Capybara.app_host = "http://#{subdomain}.lvh.me:9887" |
This file contains 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
### Models ### | |
class Post | |
include Mongoid::Document | |
references_many :properties, :stored_as => :array, :inverse_of => :posts, :index => true | |
end | |
class Property | |
include Mongoid::Document | |
field :name | |
references_many :posts, :stored_as => :array, :inverse_of => :properties |
NewerOlder