Home>
What you ’re trying to implement
I'm trying to return results in JSON using the Rails API.
Do not changeHow to get relation destination data logically deleted in Paranoia
The parent can be obtained with with_deleted as described below, but the child data cannot be obtained at the same time.
With_deleted was able to get the parent, but not the child data.
Specifically, I was able to get it with the following code.
@campaigns = Campaign.with_deleted.eager_load (: campaign_costs) .all
class Campaign
class CampaignCost
If i understand, I would appreciate it if you could teach me.
-
Answer # 1
Related articles
- ruby - how nice! function routes do not pass well (relation) [rails]
- ruby on rails - i want to be able to get the information of the link destination by pressing the link in rails
- ruby - [rails] cannot refer to the relation destination table
- ruby on rails - the transition destination of link_to does not work
- ruby - the last db setting doesn't work when deploying rails app on aws
- ruby on rails - how to transition from the top page
- ruby on rails - i want to implement a function for administrator users to register luggage for general users in rails
- ruby on rails - things associated with a foreign key cannot be called in view
- ruby on rails 6 - environment construction of ruby on rails
- ruby on rails 5 - actioncontroller :: invalidauthenticitytoken cannot be resolved
- ruby on rails - error in controller when transitioning with rails6 destory action
- ruby on rails - access fails after seed after deploying to heroku
- ruby on rails - cart function routing error cannot be resolved
- ruby on rails runtime error cannot be resolved
- ruby on rails - missing required keys: i'm having trouble resolving the [: id] error
- ruby on rails 5 - some items are not saved in db when posting from rails form
- bootstrap display in ruby on rails is broken
- ruby - [rails] i can't install the add favorite button
- ruby on rails - dealing with wrong number of arguments (given 1, expected 2)
- ruby on rails - seed fails on heroku
Trends
Currently, the default scope has been turned off as follows, but if there is any other good method, please continue your favors.