Create a Smart relationship (Rails)

Hello @muz, thanks to your feedback.

I manage to reproduce the issue on my end.
Here is a solution below:

class Forest::UsersController < ForestLiana::ApplicationController
  def all_cards
    limit = params['page']['size'].to_i
    offset = (params['page']['number'].to_i - 1) * limit

    user = User.find(params['user_id'])
    cards = Card.where(user_profile_id: user.user_profiles.ids)

    render json: serialize_models(cards.limit(limit).offset(offset), meta: {count: cards.count})
  end
end

Could you test it and give me a feedback :slight_smile:
If it’s work, I’ll fix the documentation soon

1 Like

Hi @matthv

That worked! Thanks again for all your help, I really appreciate it!

Have a great weekend!

1 Like