code
stringlengths
1
1.73M
language
stringclasses
1 value
module ActionView module Helpers module ActiveRecordHelper def error_messages_for(*params) options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {} objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact count = objects.inject(0) {|sum, ...
Ruby
module ActiveScaffold module Localization def self.lang Thread.current[:active_scaffold_lang] ||= @@lang end def self.lang=(value) Thread.current[:active_scaffold_lang] = value end @@l10s = { 'en-us' => {} } @@lang = 'en-us' def self._(string_to_localize, *args) sprintf...
Ruby
# include view helpers ActionView::Base.send :include, ActsAsAspdotnet::ViewHelpers # This is our crown jewels of the plugin. ASP.NET validation is back! ActionView::Base.send :include, ActsAsAspdotnet::ValidationHelpers::ValidationTagHelpers ActionView::Helpers::FormBuilder.send :include, ActsAsAspdotnet::Validation...
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the acts_as_aspdotnet plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the acts_as_aspd...
Ruby
# desc "Explaining what the task does" # task :acts_as_aspdotnet do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
require 'fileutils' # Workaround a problem with script/plugin and http-based repos. # See http://dev.rubyonrails.org/ticket/8189 Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do def copy_files(source_path, destination_path, directory) source, destination = File.join(directory, source_path), destination_path File...
Ruby
# The Grandaddy of all MonkeyPatches # normal send :include wouldnt work for me. # So it had to come to this. module ActionView module Helpers class InstanceTag #:nodoc: private def add_default_name_and_id(options) # yup. copy pasted from rails source. if options.has_key...
Ruby
module ActsAsAspdotnet::RoutingOverrides # OVERRIDE def resources(*entities, &block) generate_aspdotnet_routes_for_resources(self, entities) super(entities, &block) end def resource(*entities, &block) generate_aspdotnet_routes_for_resources(self, entities) super(entities, &block) end ...
Ruby
module ActsAsAspdotnet::ViewHelpers # add important tags into your <html><head> def aspdotnet_includes return [ %(<meta name="vs_showGrid" content="False">), # the "Content" is capitalized to get a more authentic feel (try it on vs2003 for yourself) %(<meta name="GENERATOR" Content="Microsoft ...
Ruby
module ActsAsAspdotnet::ValidationHelpers module ValidationTagHelpers # wrap submit tag to call doPostBack def submit_tag(value = "Save changes", options = {}) options = {:onclick => "__doPostBack();return false;"}.merge(options) super(value, options) end # add a required f...
Ruby
# include view helpers ActionView::Base.send :include, ActsAsAspdotnet::ViewHelpers # This is our crown jewels of the plugin. ASP.NET validation is back! ActionView::Base.send :include, ActsAsAspdotnet::ValidationHelpers::ValidationTagHelpers ActionView::Helpers::FormBuilder.send :include, ActsAsAspdotnet::Validation...
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the acts_as_aspdotnet plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the acts_as_aspd...
Ruby
# desc "Explaining what the task does" # task :acts_as_aspdotnet do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
require 'fileutils' # Workaround a problem with script/plugin and http-based repos. # See http://dev.rubyonrails.org/ticket/8189 Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do def copy_files(source_path, destination_path, directory) source, destination = File.join(directory, source_path), destination_path File...
Ruby
# The Grandaddy of all MonkeyPatches # normal send :include wouldnt work for me. # So it had to come to this. module ActionView module Helpers class InstanceTag #:nodoc: private def add_default_name_and_id(options) # yup. copy pasted from rails source. if options.has_key...
Ruby
module ActsAsAspdotnet::RoutingOverrides # OVERRIDE def resources(*entities, &block) generate_aspdotnet_routes_for_resources(self, entities) super(entities, &block) end def resource(*entities, &block) generate_aspdotnet_routes_for_resources(self, entities) super(entities, &block) end ...
Ruby
module ActsAsAspdotnet::ViewHelpers # add important tags into your <html><head> def aspdotnet_includes return [ %(<meta name="vs_showGrid" content="False">), # the "Content" is capitalized to get a more authentic feel (try it on vs2003 for yourself) %(<meta name="GENERATOR" Content="Microsoft ...
Ruby
module ActsAsAspdotnet::ValidationHelpers module ValidationTagHelpers # wrap submit tag to call doPostBack def submit_tag(value = "Save changes", options = {}) options = {:onclick => "__doPostBack();return false;"}.merge(options) super(value, options) end # add a required f...
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
class CreateMovies < ActiveRecord::Migration def self.up create_table :movies, :force => true do |t| t.column :name, :string t.column :description, :string end end def self.down drop_table :movies end end
Ruby
class CreateCategories < ActiveRecord::Migration def self.up create_table :categories, :force => true do |t| t.column :name, :string end end def self.down drop_table :categories end end
Ruby
class CreateAuthors < ActiveRecord::Migration def self.up create_table :authors, :force => true do |t| t.column :name, :string t.column :biography, :text end end def self.down drop_table :authors end end
Ruby
class CreatePostings < ActiveRecord::Migration def self.up execute "CREATE TABLE postings(`guid` varchar(20) NOT NULL PRIMARY KEY, `name` varchar(200), `description` text)" end def self.down drop_table :postings end end
Ruby
class CreateBooks < ActiveRecord::Migration def self.up create_table :books, :force => true do |t| t.column :category_id, :integer t.column :name, :string t.column :author, :string end end def self.down drop_table :books end end
Ruby
class CreateElectronics < ActiveRecord::Migration def self.up create_table :electronics, :force => true do |t| t.column :name, :string t.column :manufacturer, :string t.column :features, :string t.column :category, :string t.column :price, :string end end def self.down d...
Ruby
require 'logger' ActiveRecord::Base.logger = Logger.new("debug.log") ActiveRecord::Base.establish_connection( :adapter => "mysql", :username => MYSQL_USER, :encoding => "utf8", :database => "actsassolr_tests" )
Ruby
require 'logger' ActiveRecord::Base.logger = Logger.new("debug.log") ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :encoding => "utf8", :database => File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'test.db') )
Ruby
require 'rubygems' require 'test/unit' require 'active_record' require 'active_record/fixtures' RAILS_ROOT = File.dirname(__FILE__) unless defined? RAILS_ROOT RAILS_ENV = 'test' unless defined? RAILS_ENV require File.dirname(__FILE__) + '/../lib/acts_as_solr' require File.dirname(__FILE__) + '/../config/environment....
Ruby
# Table fields for 'electronics' # - id # - name # - manufacturer # - features # - category # - price class Electronic < ActiveRecord::Base acts_as_solr :facets => [:category, :manufacturer], :fields => [:name, :manufacturer, :features, :category, {:price => {:type => :range_float, :boost => 10.0}}], ...
Ruby
# Table fields for 'books' # - id # - category_id # - name # - author class Book < ActiveRecord::Base belongs_to :category acts_as_solr :include => [:category] end
Ruby
# Table fields for 'movies' # - guid # - name # - description class Posting < ActiveRecord::Base set_primary_key 'guid' acts_as_solr({},{:primary_key_field => 'pk_s'}) end
Ruby
# Table fields for 'categories' # - id # - name class Category < ActiveRecord::Base has_many :books acts_as_solr :include => [:books] end
Ruby
# Table fields for 'movies' # - id # - name # - description class Movie < ActiveRecord::Base acts_as_solr :additional_fields => [:current_time, {:time_on_xml => :date}] def current_time Time.now.to_s end def time_on_xml Time.now end end
Ruby
# Table fields for 'movies' # - id # - name # - biography class Author < ActiveRecord::Base acts_as_solr :auto_commit => false end
Ruby
require 'fileutils' def install(file) puts "Installing: #{file}" target = File.join(File.dirname(__FILE__), '..', '..', '..', file) FileUtils.cp File.join(File.dirname(__FILE__), file), target dir_to_rename = File.dirname(__FILE__) + '/../trunk' FileUtils.mv(dir_to_rename, File.dirname(__FILE__) + '/../acts_...
Ruby
require 'rubygems' require 'rake' require 'rake/testtask' Dir["#{File.dirname(__FILE__)}/lib/tasks/**/*.rake"].sort.each { |ext| load ext } desc "Default Task" task :default => [:test] desc 'Runs the tests' task :test do ENV['RAILS_ENV'] = "test" require File.dirname(__FILE__) + '/config/environment' puts "Usi...
Ruby
# Copyright (c) 2006 Erik Hatcher, Thiago Jackiw # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, ...
Ruby
ENV['RAILS_ENV'] = (ENV['RAILS_ENV'] || 'development').dup SOLR_PATH = "#{File.dirname(File.expand_path(__FILE__))}/../solr" unless defined? SOLR_PATH unless defined? SOLR_PORT SOLR_PORT = ENV['PORT'] || case ENV['RAILS_ENV'] when 'test' then 8981 when 'production' then 8983 ...
Ruby
module ActsAsSolr #:nodoc: module ActsMethods # declares a class as solr-searchable # # ==== options: # fields:: This option can be used to specify only the fields you'd # like to index. If not given, all the attributes from the # class will be indexed. You can also use thi...
Ruby
# Copyright (c) 2006 Erik Hatcher, Thiago Jackiw # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, ...
Ruby
module ActsAsSolr #:nodoc: module CommonMethods # Converts field types into Solr types def get_solr_field_type(field_type, indexed = true, stored = true) suffix = "" suffix = "_idx" if indexed && !stored suffix = "_stor" if !indexed && stored if field_type.is_a?(Symbol) case...
Ruby
require File.dirname(__FILE__) + '/../solr_fixtures' namespace :db do namespace :fixtures do desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y" task :load => :environment do puts "In database.rake in acts_as_solr" begin ActsAsSolr::Post...
Ruby
require 'rubygems' require 'rake' require 'net/http' require 'active_record' require "#{File.dirname(__FILE__)}/../../config/environment.rb" namespace :solr do desc 'Starts Solr. Options accepted: RAILS_ENV=your_env, PORT=XX. Defaults to development if none.' task :start do rails_root = File.join(File.dirname...
Ruby
require 'active_record' namespace :test do task :migrate do ActiveRecord::Migrator.migrate("test/db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) end end
Ruby
module ActsAsSolr class SolrFixtures def self.load(table_names) puts "Loading SolrFixtures" [table_names].flatten.map { |n| n.to_s }.each do |table_name| klass = instance_eval(File.split(table_name.to_s).last.to_s.gsub('_',' ').split(" ").collect{|w| w.capitalize}.to_s.singularize) if...
Ruby
module ActsAsSolr #:nodoc: module InstanceMethods # Solr id is <class.name>:<id> to be unique across all models def solr_id "#{self.class.name}:#{record_id(self)}" end # saves to the Solr index def solr_save return true unless configuration[:if] if evaluate_condition(configura...
Ruby
require File.dirname(__FILE__) + '/common_methods' require File.dirname(__FILE__) + '/parser_methods' module ActsAsSolr #:nodoc: module ClassMethods include CommonMethods include ParserMethods @@row_even = true # Finds instances of a model. Terms are ANDed by default, can be overwritten # by us...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
#!/usr/bin/env ruby # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
class Solr::Response::Dismax < Solr::Response::Standard # no need for special processing # FIXME: 2007-02-07 <coda.hale@gmail.com> -- The existence of this class indicates that # the Request/Response pair architecture is a little hinky. Perhaps we could refactor # out some of the most common functionality -...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
#!/usr/bin/env ruby # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
module ActsAsSolr #:nodoc: module ParserMethods MODIFIER_SUFFIXES = %w(idx stor mv) TYPE_SUFFIXES = %w(i s d t f b ri rf facet) protected # Method used by mostly all the ClassMethods when doing a search def parse_query(options={}, models=nil) valid_options = [:offset, :limit, :facets, :mo...
Ruby
module ActsAsSolr #:nodoc: # TODO: Possibly looking into hooking it up with Solr::Response::Standard # # Class that returns the search results with four methods. # # books = Book.find_by_solr 'ruby' # # the above will return a SearchResults class with 4 methods: # # docs|results|records: will...
Ruby
# The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Ruby
module ActsAsSolr #:nodoc: class Post def initialize(body, mode = :search) @body = body @mode = mode puts "The method ActsAsSolr::Post.new(body, mode).execute_post is depracated. " + "Use ActsAsSolr::Post.execute(body, mode) instead!" end def execute_post ActsAsS...
Ruby
module ActsAsSolr class QueryBuilder def initialize(options) @conditions = [] @conditions += self.class.parse_conditions(options[:conditions]) @order = options[:order] end def self.parse_conditions(conditions) result = [] conditions = [conditions] unless conditions.is_a?(Arr...
Ruby
# = Authorize.net Customer Information Management # # == General Usage # gateway = ActiveMerchant::Billing::AuthorizeNetCimGateway.new :login => 'name', :password => 'transactionKey' # # resp = gateway.create_profile(profile_data) # if resp.success? # customer.profile_id = resp.params['data'][:customerProf...
Ruby
#-- xmlsimple loads ActiveSupport (again), so we suppress annoying warning messages verbose, $-v = $-v, nil require 'xmlsimple' $-v = verbose module ActiveMerchant module Billing module AuthorizeNetCimAPI class Request < Base alias_method :children_to_xml, :to_xml self.scalar_attributes ...
Ruby