I'm trying to return results in JSON using the Rails API.Do not change
How 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
If i understand, I would appreciate it if you could teach me.
Answer # 1
Currently, the default scope has been turned off as follows, but if there is any other good method, please continue your favors.
- ruby - [rails] cannot refer to the relation destination table
- ruby on rails - the transition destination of link_to does not work
- ruby on rails - i want the link destination to be displayed normally
- ruby - i made a comment model, post model, user model relation with rails, but commentusername is a nil error
- ruby on rails data is not saved in db? ??
- ruby - [rails] posts added to favorites are not saved
- ruby on rails - i want to make a flea market app with rails and stripe, but i can't have a system to send money to the seller
- ruby on rails - i can't get aws environment variables in rails
- ruby on rails - [rails] form_with submit button does not respond
- ruby - [rails] data is not saved due to activerecord :: notnullviolation error
- ruby on rails - i can't implement the like function
- ruby - if i accidentally do rails db: drop, the database disappears and i can't deploy it can i get it back?
- ruby on rails 6 - @ commentsave cannot be done
- ruby - rails can't receive the value passed from the form
- ruby - [rails] i want to use fields_for with form_with, but an error occurs and the page cannot be displayed
- ruby on rails - i want to pass the id of the choicekadai table
- ruby - when i do "rails s -e production" on ec2, i get "missing required arguments: aws_access_key_id"
- ruby on rails 6 - rails6 gives argumenterror in postscontroller # create
- ruby on rails 6 - how to decide whether to update or delete with rails after_update (callback)
- ruby - rails server startup does not work operation cannot be confirmed
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- python - you may need to restart the kernel to use updated packages error
- python 3x - typeerror: 'method' object is not subscriptable
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- xcode - pod install [!] no `podfile 'found in the project directory
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- android studio - unresolved reference comes out in kotlin