Closed RobertLowe closed 13 years ago
Well, thats a specific feature of activescaffold master branch.
It s not in my fork and so far on purpose cause I do not see any benefits.
So please use override names without controller name
Which I agree with for brevity;
It's just rough having it not documented... perhaps noting it here is enough
Thanks, added it to the differences section in wiki
I've done some digging, and I think I found a problem here. I have two models that share a number of the same field names. Because Rails 3 now includes all helpers in all controllers, my overrides are conflicting. Any other way around this?
Are you placing them all in ApplicationHelper or [Model]Helper?
A ghetto hack might be to check which class the column call is passing
def email_column(record)
if record.klass == User
...
end
end
But that's kind of ghetto
Why is that a ghetto hack? IMHO That s a clean way to manage it.
Everything is in [controller]_helper.rb files, but Rails 3 apparently just throws all helpers into all controllers. There was some back and forth on the lighthouse ticket, but no resolution.
But the klass checking code with a case statement might be a better solution for the helpers that require it, and not for those that don't. Then, move everything up to application_helper. It seems like it could be a DRYer solution.
For the moment, I've hacked the AS 2.3 method into my own fork and renamed all my methods to the [class]_[field]_column convention, but I'll check this out too.
You do not have to hack this into a special fork... You can just define an override in your application helper file.. eg. def column_override(column) end
Why is that a ghetto hack? IMHO That s a clean way to manage it.
Haha, yah, it ain't that bad
Ran into a wall with helpers being documented differently than the master:
https://github.com/activescaffold/active_scaffold/blob/master/lib/active_scaffold/helpers/list_column_helpers.rb
https://github.com/vhochstein/active_scaffold/blob/master/lib/active_scaffold/helpers/list_column_helpers.rb
As you can see on vhochstein's fork, an override is works like
email_column
, whereas on the master and it runs likeuser_email_column
, seems like things got mixed in with pre-v2.3Regards