Questions tagged [grape-entity]

grape-entity - Entities - a simple Facade to use with your models and API - extracted from Grape.

grape-entity - Entities - a simple Facade to use with your models and API - extracted from Grape.

https://github.com/intridea/grape-entity

51 questions
0
votes
1 answer

grape-entity and has_many requires explicit entity

I'm using grape and grape-entity in a Rails 4.2.1 project, and I'm running into a weird error with presenting using the right model. According to the documentation, organizing my entities within each model results in this: Grape will automatically…
Waynn Lue
  • 11,344
  • 8
  • 51
  • 76
0
votes
1 answer

How to dynamically change formatter in grape API?

My API should some times return data as CSV format. But depending the data returned, the CSV formatter act differently (as hierachical data, should be flatten following specific rules depending the data) So i've written many customs CSV…
fabien-michel
  • 1,873
  • 19
  • 38
0
votes
1 answer

Grape 'text' type parameter

I have a column type TEXT in my database. What type of parameter should I declare in my API? params do requires :body, type: Text end The code above produces this error: uninitialized constant API::Articles::Text (NameError) I tried setting the…
0
votes
1 answer

Grape API to return record that match query

I have 2 models: employee and jobs Employee has many jobs and jobs belongs to employee I have the CRUD endpoint for employee and jobs in my API And finally I have the models employee to accept nested attributes from jobs so when a employee is…
0
votes
1 answer

Problems exposing has_and_belongs_to_many relation using Grape::Entity

i have Trip model which has destinations defined like that: class Trip < ActiveRecord::Base ... has_and_belongs_to_many :destinations, join_table: :trips_destinations ... end What I want to do is to expose the trip information included…
halbano
  • 1,135
  • 14
  • 34
0
votes
1 answer

Grape entities with has_many through relationships

I'm adding REST api with the grape gem. I also added the grape-entities gem. What I need is that data from these three models: Product, Company and ManufactureCompany in one json file. The relationships in product.rb: has_many…
DR_
  • 174
  • 1
  • 2
  • 14
1 2 3
4