Comments (8)
Also when I call columns[:product].update = [:batch] inside ItemsController,
everytime I change Product value inside Items form, Batch column updates also
inside Invoices form - parent
Original comment by [email protected]
on 13 Jul 2010 at 10:09
from activescaffold.
Add explaining screenshot to better understand `update` field problem.
Original comment by [email protected]
on 13 Jul 2010 at 2:25
Attachments:
from activescaffold.
Changed parent model assocation to `batch_no` instead of `batch`. Now I get an
JS error: TypeError: $("record_batch_") is null
Original comment by [email protected]
on 13 Jul 2010 at 5:37
from activescaffold.
After some debugging and brain exertion, I came with solution for this problem.
Just needed to change one single variable (In
"lib/active_scaffold/helpers/form_column_helpers.rb"
javascript_for_update_column)
FROM:
url_params[:scope] = params[:scope] || scope
TO:
url_params[:scope] = scope || scope
params[:scope] seems to be empty most of the time in this method.
And here is as_overrides.rb for people who encounters same problem:
module ActiveScaffold
module Helpers
module FormColumnHelpers
def javascript_for_update_column(column, scope, options)
if column.update_column
form_action = :create
form_action = :update if params[:action] == 'edit'
url_params = {:action => 'render_field', :id => params[:id], :column => column.name, :update_column => column.update_column}
url_params[:eid] = params[:eid] if params[:eid]
url_params[:controller] = controller.class.active_scaffold_controller_for(@record.class).controller_path if scope
url_params[:scope] = scope if scope
#url_params[:scope] = params[:scope] if scope # Was this, but params[:scope] seem to be always empty in this method
ajax_options = {:method => :get,
:url => url_for(url_params), :with => column.send_form_on_update_column ? "Form.serialize(this.form)" : "'value=' + this.value",
:after => "$('#{loading_indicator_id(:action => :render_field, :id => params[:id])}').style.visibility = 'visible'; Form.disable('#{element_form_id(:action => form_action)}');",
:complete => "$('#{loading_indicator_id(:action => :render_field, :id => params[:id])}').style.visibility = 'hidden'; Form.enable('#{element_form_id(:action => form_action)}');"}
options[:onchange] = "#{remote_function(ajax_options)};#{options[:onchange]}"
end
options
end
end
end
end
Original comment by [email protected]
on 17 Jul 2010 at 8:44
from activescaffold.
[deleted comment]
from activescaffold.
params[:scope] should be filled when render_field action is requested, don't
you get params[:scope] in your render_action request?
About your conditions for association issue, in a form for batch with items and
invoices subforms, only methods from BatchesHelper will be used, unless you
have helper :all in your application controller. You can test
"@record.is_a?(Item) && assoc.name == :batch"
Another time submit one issue for each problem.
Original comment by [email protected]
on 19 Jul 2010 at 7:07
from activescaffold.
Nope, I do not get params[:scope] (maybe it is blacklisted param in AS?). I
spent great deal of time trying to find in AS where things get wrong.
Situation with helpers is clear for me at the moment. However, maybe it would
be better to call helper override methods also using class names, because if
you have few separate models working in one window and these models have fields
which have same names and you write a form or condition override method, then
it applies to both fields, and this leads to pain and you have to rename
columns. (Experienced this exact situation)
Sorry for mixing things up.
Original comment by [email protected]
on 20 Jul 2010 at 7:07
from activescaffold.
I will improve naming of helper overrides if it's possible without breaking
backwards compatibility.
A recent fix introduced a bug with render_field and fields with scope,
params[:scope] shouldn't be used. I was confused because the line is
url_options[:scope] = params[:scope] if scope, not url_options[:scope] =
params[:scope] || scope. We need much more tests to avoid these issues.
It's fixed now
Original comment by [email protected]
on 21 Jul 2010 at 8:15
- Changed state: Fixed
from activescaffold.
Related Issues (20)
- Custom conditions_for_collection do not propagate to pagination, sorting HOT 1
- Draggable lists don't render properly in IE7 HOT 2
- Polymorphic assoc. How to figure out parent model class name inside helper? HOT 3
- Incompatibility with CKEditor plugin HOT 3
- JavaScript error HOT 17
- html_options for form_ui=:checkbox HOT 1
- STI model with association gets "can't dup NilClass" error. HOT 1
- Rails 3 support? HOT 1
- Not Compatible With Parameterized Configuration HOT 10
- NoMethodError during functional testing of ActiveScaffold controllers HOT 7
- associations' file_column bridge view render wrong id/name for hidden delete parameter HOT 1
- Field Search - NoMethodError (undefined method `each' for "":String): FIX HOT 1
- links_for_association called before the config block is run HOT 1
- Enhancement of active_scaffold_input_singular_association HOT 6
- Reduce amount of logged information HOT 2
- AJAX close methods do not honour path_prefix of application routes
- record should be reloaded in case of StaleObjectError
- routing error if field id is NULL HOT 3
- When using nested scaffold action, sorting on the nested scaffold breaks when using sort_by... HOT 1
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 activescaffold.