Search code examples
ruby-on-railssearchrubygemscategories

Rails for mobile API


I want to create a service with many posts, which have many attributes. Users enter data (age, gender, category, etc.) and get some posts.

  1. Which gem use for search by categories?
  2. Tell me please the best way to create API for mobile phones.

Solution

    1. There are many options for implementing search, depending on what you need. Rails has easy integration with elasticsearch which provides full text search capabilities. For, search by categories, you can even use plain ActiveRecord queries to get this done to some extent. Again, depending on your need.

    2. You can use active_model_serializers or jbuilder for building JSON API using Rails and then your mobile clients can consume these APIs.

    There are lots of resources about how to build a JSON API in Rails using AMS or jbuilder. You just need to google it.