-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cached association #434
Comments
What is really strange is that both associations render perfect until I submit the form on either... then the opposite association no longer has the one is now missing the others form for that association... Hope this makes sense. class ShareholderRelationship < ActiveRecord::Base |
If you can create a sample app to reproduce it, it would easier to debug it by me |
config.columns[:appliance_id].form_ui = :select |
@lklkdawei your problem seems different, at least @markmcdonald51 didn't say he were setting options in controller. If you set options in that way, they will be loaded when app starts, not on every request. You should use applicance column if appliance is a belongs_to association, set form_ui to :select, and ActiveScaffold will load all recycling appliance (your association must be belongs_to :appliance, class_name: 'RecyclingAppliance'). If you want to filter some records from select, you can define options_for_association_conditions or association_klass_scoped in your helper: https://github.com/activescaffold/active_scaffold/wiki/Custom-Association-Options |
Hi,
I noticed an interesting thing happens when I use an association that uses a through: association on the reverse association.
So for example, I have models for company and shareholder and a join table in between called company_shareholders that contains the company_id and shareholder_id.... I made a has_many shareholders, through: :company_shareholders and a has_many :companies, through: :company_shareholders in their reverse association.
The interesting thing is when it is rendered it sometimes will show the correct fields, meaning it excludes company in the company edit/add and excludes shareholders in the shareholder forms... But eventually it will get catched and then be missing either of the associations, which makes the form invalid in this case.
For a simple fix, I have just included it in only one controller (the companies cntlr) but it would be super nice if it would work in both as it is a much simpler way to edit.
I should tell you that I am also using the form_ui :chosen for both of the associations.
If this isn't fixable or it is just the way rails caches it's ok. Just wanted to report this as I have not found a way to fix it mingling in the controller code.
Thanks in advance.
Mark
The text was updated successfully, but these errors were encountered: