activerecord-multi-tenant | ActiveRecord support for distributed multi | Database library
kandi X-RAY | activerecord-multi-tenant Summary
kandi X-RAY | activerecord-multi-tenant Summary
Rails/ActiveRecord support for distributed multi-tenant databases like Postgres+Citus
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This method will return a sub - tenant object .
- Builds an ActiveRecord relation .
- Extracts a relation from the given relation .
- Set the current_tenant for the current_tenant .
- Pushes an array of jobs into a hash
- Visit nodes for a specific node
- Creates a new task .
- delete a new instance of this object
activerecord-multi-tenant Key Features
activerecord-multi-tenant Examples and Code Snippets
Community Discussions
Trending Discussions on activerecord-multi-tenant
QUESTION
I have a Rails 6 project, I am Citusdata/activerecord-multi-tenant gem to handle my row based MultiTenancy I am trying to create a TimeSheet for a User
as it is right now I can't access current_user to save the relationship. My console output is not helpful at all:
It is connecting the relationship to the account model and auto saves my account_id, but fails to collect the user.id or current_user.id
I can drop a byebug in both new and create blocks, however when I pass the byebug below @time_sheet.save
it comes back as nil.
Im stuck here, not sure where I'm going wrong here? I have done this plenty in the past.
Here is how its all set up:
...ANSWER
Answered 2020-Mar-26 at 16:09Looks like you are not passing the user_id correctly when creating the time_sheet. Change your new method to include the current_user id by merging it into your time_sheet_params like this:
@time_sheet = TimeSheet.new(time_sheet_params.merge(user_id: current_user.id)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install activerecord-multi-tenant
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page