Integrations
/
Frameworks
/
Rails
/
Advanced Usage
Aug. 11, 2021
Advanced Usage
Using the API client
You would typically need to use the Algolia client to perform API keys operations. The client is available as a singleton and will use the algolia credentials set in the Rails configuration.
Copy
1
key = AlgoliaSearch.client.add_api_key({ acl: ['search'], 'indexes': ['*_development', '*_development.tmp'] })
Using the model underlying the index
If you want to access the index used by a model, you can call the index
class method. This method follows your naming configuration (per environment settings or custom names, for instance).
Copy
1
2
index = Contact.index
# index.get_settings, index.partial_update_object, ...
Did you find this page helpful?