Coder Social home page Coder Social logo

typesense / typesense-rails Goto Github PK

View Code? Open in Web Editor NEW
9.0 7.0 2.0 1.63 MB

Rails Integration for Typesense | Work in Progress | Help Needed

Home Page: https://typesense.org

License: MIT License

Dockerfile 0.09% Ruby 99.91%
typesense typesense-ruby typesense-rails rails ruby-on-rails

typesense-rails's Introduction

typesense-rails

This is a fork of Algolia's Rails integration, adapted to work with Typesense.

It is mostly complete, but it needs testing with multiple Rails apps and some tweaking before we can publish it officially. We're looking for contributors to help with this. If you're interested, please install the adaptations branch of this gem in your Rails app, give it a spin and then open issues in the issue tracker with feedback. We'd definitely appreciate PRs to address these issues as well.

Please join the #contributions channel in our Slack community and introduce yourself, if you'd like to collaborate.

typesense-rails's People

Contributors

alexandremeunier avatar algoliareadmebot avatar annikoff avatar chibicode avatar chloelbn avatar elpicador avatar gasparila avatar jeromedalbert avatar jerska avatar jerskouille avatar joshuapinter avatar julienbourdeau avatar kennym avatar kiyohara avatar ldlgds2 avatar mikeastock avatar nagriar avatar nicolasleger avatar nunomaduro avatar outoftime avatar philfreo avatar poilon avatar raphi avatar redox avatar ruckus avatar sarahdayan avatar simonireilly avatar sobrinho avatar vvo avatar zapnap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kevinsia cesmoak

typesense-rails's Issues

Adding gem changes global logging settings.

  • Rails version: 5.1.7
  • Typesense Rails integration version: adapation
  • Typesense Client Version: 0.13.0
  • Language Version: 2.7.2

Description

Typesense shouldn't affect logging from migrate tasks / specs

Steps To Reproduce

rbenv local 2.7.2
rails _5.1.7_ new foo
cd foo
rails g model Bar
rails db:migrate

Output of migrate

== 20220331123536 CreateBars: migrating =======================================
-- create_table(:bars)
   -> 0.0003s
== 20220331123536 CreateBars: migrated (0.0003s) ==============================

Then

rails db:drop
echo "gem 'typesense-rails', git: 'https://github.com/typesense/typesense-rails.git', branch: 'adaptation'" >> Gemfile
bundle install
rails db:migrate

Output of migrate

   (0.0ms)  SELECT sqlite_version(*)
   (1.0ms)  CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
   (0.5ms)  CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
   (0.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Migrating to CreateBars (20220331123536)
   (0.0ms)  begin transaction
== 20220331123536 CreateBars: migrating =======================================
-- create_table(:bars)
   (0.2ms)  CREATE TABLE "bars" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
   -> 0.0003s
== 20220331123536 CreateBars: migrated (0.0003s) ==============================

  SQL (0.0ms)  INSERT INTO "schema_migrations" ("version") VALUES (?)  [["version", "20220331123536"]]
   (0.3ms)  commit transaction
  ActiveRecord::InternalMetadata Load (0.0ms)  SELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?  [["key", "environment"], ["LIMIT", 1]]
   (0.0ms)  begin transaction
  SQL (0.1ms)  INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["key", "environment"], ["value", "development"], ["created_at", "2022-03-31 12:42:21.424311"], ["updated_at", "2022-03-31 12:42:21.424311"]]
   (0.2ms)  commit transaction
   (0.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

I think this should be done in the railtie / engine rather than top level of the file.

This also changes the logging setting when running specs.

https://github.com/typesense/typesense-rails/blob/adaptation/lib/typesense-rails.rb#L20-L22

Edit: Some further investigation shows that we were getting the logger defined in

https://github.com/rails/rails/blob/5-1-stable/railties/lib/rails/application/bootstrap.rb#L33

We are currently handling this by changing config/environment.rb to unset loggers set before the application is initialized

require_relative 'application'

Rails.logger = nil
Rails.application.initialize!

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.