diff --git a/app/models/concerns/searchable.rb b/app/models/concerns/searchable.rb index f1a7ada96..10a88223d 100644 --- a/app/models/concerns/searchable.rb +++ b/app/models/concerns/searchable.rb @@ -42,32 +42,35 @@ module Searchable private def create_in_search_index - fields_sql = [ "rowid", *search_fields ].join(", ") - placeholders = ([ "?" ] * (search_fields.size + 1)).join(", ") - values = [ id, *search_values ] + # # TODO:PLANB: need to replace SQLite FTS + # fields_sql = [ "rowid", *search_fields ].join(", ") + # placeholders = ([ "?" ] * (search_fields.size + 1)).join(", ") + # values = [ id, *search_values ] - execute_sql_with_binds( - "insert into #{search_table}(#{fields_sql}) values (#{placeholders})", - *values - ) + # execute_sql_with_binds( + # "insert into #{search_table}(#{fields_sql}) values (#{placeholders})", + # *values + # ) end def update_in_search_index - transaction do - set_clause = search_fields.map { |field| "#{field} = ?" }.join(", ") - binds = search_values + [ id ] + # # TODO:PLANB: need to replace SQLite FTS + # transaction do + # set_clause = search_fields.map { |field| "#{field} = ?" }.join(", ") + # binds = search_values + [ id ] - updated = execute_sql_with_binds( - "update #{search_table} set #{set_clause} where rowid = ?", - *binds - ) + # updated = execute_sql_with_binds( + # "update #{search_table} set #{set_clause} where rowid = ?", + # *binds + # ) - create_in_search_index unless updated - end + # create_in_search_index unless updated + # end end def remove_from_search_index - execute_sql_with_binds "delete from #{search_table} where rowid = ?", id + # # TODO:PLANB: need to replace SQLite FTS + # execute_sql_with_binds "delete from #{search_table} where rowid = ?", id end def execute_sql_with_binds(*statement) diff --git a/app/models/current.rb b/app/models/current.rb index ad5131128..9a9189d96 100644 --- a/app/models/current.rb +++ b/app/models/current.rb @@ -8,9 +8,8 @@ class Current < ActiveSupport::CurrentAttributes def session=(value) super(value) - # # TODO:PLANB: not sure how to patch this up right now - # unless value.nil? - # self.membership = identity.memberships.find_by(tenant: ApplicationRecord.current_tenant) - # end + if value.present? && Current.account.present? + self.membership = identity.memberships.find_by(tenant: Current.account.external_account_id) + end end end diff --git a/bin/dev b/bin/dev index a798bc227..287127eda 100755 --- a/bin/dev +++ b/bin/dev @@ -1,7 +1,7 @@ #!/usr/bin/env sh bin/rails runner - <