Comments (6)
I think the only hope of getting this fixed is, if you can attach a some minimum code that we can run locally and reproduce the problem.
from rails.
I created a minimal rails example project with a readme file explaining how to reproduce the problem:
git://github.com/larsar/rails-issue-403.git
from rails.
Thanks @larsar and @gnufied. Can any of the several contributors now isolate the issue from the minimal rails app to a test case in Rails? This would help us a lot in moving on and fixing the issue. ❤️
from rails.
On having a look at the sample code, this is not a bug. The problems with code:
- Following code is wrong and will not work
has_many :deliveries, :as => :notifiable
has_many :members, :through => :deliveries, :source => :notifiable, :source_type => "Member"
Because when you will say notification.members
it will create the join with where condition deliveries.notifiable_id=1 AND deliveries.notifiable_type = 'Notification'
. Clearly thats not what you want.
-
When you are creating
deliveries
indirectly vianotification.members << member
, it WILL setnotifiable_id
andnotifiable_type
correctly in deliveries table, but AR has no way of knowing that you want to setnotification_id
in deliveries table as well. It is impossible, you will have to set that yourself.In other words, you are expecting too much from Rails here. :)
from rails.
Ok, closing. Thanks @gnufied.
from rails.
Thanks for taking the time to look at this. I'll have to let it sink in and try another solution then. :)
from rails.
Related Issues (20)
- Association with the same name as the demodularized model name is incorrectly inferred
- New `permanent_connection_checkout` does not seem to work as expected. HOT 4
- [Edge Guides]: Text in some code snippets not readable (low contrast) HOT 1
- Unexpected behavior when calling `Model.find_by_id` with `true` or `false` HOT 5
- Migration Guide needs to cover out-of-order migrations HOT 1
- Range of dates with infinite end are stored incorrectly in Postgres database HOT 2
- `config.assets.debug` has misleading documentation HOT 1
- ActiveSupport::KeyGenerator hash digest class differs during and after application initialization
- Adding database_tasks: false to primary database breaks migrations in another database HOT 1
- Allow `turbo-rails` to be excluded from new applications with the `--ignore-action-cable` flag? HOT 1
- Add :method docs for ActiveRecord::AttributeMethods::Dirty dynamic methods
- [ActiveRecord] upsert not updating updated_at when no changes HOT 1
- Secret key base is required during Docker build if credentials used in before_action HOT 3
- `scope_attributes` leaks into Active Record life cycle callbacks since PR #51725 HOT 2
- Update Supported Rails Versions for Trix v2 for CVE-2024-34341 HOT 2
- Possible race condition in postgresql type_map initialization
- rspec tests won't after upgrading from rails 7.1.2 to 7.1.3.2: can't modify frozen Array when requiring environment file HOT 2
- form_with reverting to HTML processing only HOT 5
- Inaccurate docs/comments about ActiveStorage video previewer defaults could be improved
- Inconsistent model state when dumped and loaded with Marshal version 7.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails.