Giter Site home page Giter Site logo

constructorio-rails's Introduction

Constructor.io

A Rails client for the Constructor.io API. Constructor.io provides a lightning-fast, typo-tolerant autocomplete service that ranks your users' queries by popularity to let them find what they're looking for as quickly as possible.

Installation

Add this line to your application's Gemfile:

gem 'constructorio-rails'

And then execute:

$ bundle

Or install it yourself:

$ gem install constructorio-rails

Usage

Configuration for Rails

Add an initializer file at config/initializers/constructor-io.rb with values from the customer dashboard:

ConstructorIORails.configure do |config|
  config.api_token = 'API_TOKEN'
  config.autocomplete_key = 'AUTOCOMPLETE_KEY'
  config.autocomplete_section = 'Search Suggestions'
end

To add autocomplete to a model:

class MyModel < ActiveRecord::Base
  include ConstructorIORails
  constructorio_autocomplete(['attribute1', 'attribute2'])
end

To attach an autocomplete dropdown to an input field, just insert this in your view:

<%= constructorio_autocomplete(dom_id: 'id_of_input_field') %>

To import an existing data set into Constructor.io, you can use the rake task:

rake constructorio:import:model CLASS='MyModel'

constructorio-rails's People

Contributors

danmcc avatar stevenlai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.