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
| # Allow the metal piece to run in isolation | |
| require File.expand_path('../../../config/environment', __FILE__) unless defined?(Rails) | |
| class AutoComplete | |
| def self.call(env) | |
| if env["PATH_INFO"] =~ /^\/auto_complete\/tags/ | |
| params = Rack::Request.new(env).params | |
| sql = "SELECT name | |
| FROM tags | |
| WHERE name LIKE #{ActiveRecord::Base.connection.quote(params['q']+'%')} |
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 File.dirname(__FILE__) + '/../test_helper' | |
| class MashAppTest < ActiveSupport::TestCase | |
| context "A MashApp instance" do | |
| setup do | |
| @mash_app = Factory.create(:mash_app) | |
| 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
| --- | |
| cwd: /home/unicef/staging/current | |
| port: "9070" | |
| user: unicef | |
| group: mongrel | |
| environment: staging | |
| address: 127.0.0.1 | |
| pid_file: log/mongrel.pid | |
| servers: 2 |
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
| module Spock | |
| module Base | |
| module Filterable | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
| module ClassMethods | |
| def filter(f) |
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
| # Usage | |
| # @assets = Asset.my_filter(params[:filter]).public.all # works like a charm | |
| # @assets = @account.assets.my_filter(params[:filter]).public.paginate({ | |
| # :page => (params[:page] || 1) | |
| # }) # works BUT (ofc) does not adhere to the @account scope | |
| # | |
| # initializer | |
| ActiveRecord::Base.send :include, Spock::Base::Filterable |
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
| ActiveRecord::Base.send :include, Spock::Base::Filterable | |
| module Spock | |
| module Base | |
| module Filterable | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
NewerOlder