Well...
I have the same problem... and I found an ad hoc "quick fix"...
I looked in:
/vendor/plugins/active_scaffold/lib/active_scaffold/actions/nested.rb
and compare the code with an older version of AS that worked.
Previously the only possible resulting action was "show", and thus we
could simply remove the lines:
if actions.include? :update and
model.authorized_for? :action => :update
action = 'edit'
... but doing that we loose some interesting functionality ...
Another approach could be to remove the link when nested:
def links_for_associations
if nested?
return # MY PATCH
end
active_scaffold_config.list.columns.each do |column| (...)
As I said before, these are just ad hoc solutions just to lock off
while waiting for a quality code from the AS team.
Hope it helps...
On Jan 5, 4:45 pm, Kumala <[email protected]> wrote:
> Sounds complicated but easy to replicate.
> I have 3 classes: Building, Room, Operator
> Building has many rooms / Room Belongs to Building
> Operator has many rooms / Room belongs to Operator
>
> I use
> config.columns[:building].form_ui = :select
> config.columns[:operator].form_ui = :select
> in the room controller to show a link to the building and the operator
> in the list view. If I click on the operator link, I get the error
> message:
> RJS Error
> TypeError: element is null
>
> Element.update("room-messages","\n \n\n \n\n \n\n");
>
> Once I close the dialog box, everything continues as normal.
>
> How do I get rid of those error dialog boxes? Is this a bug?
>
> Here the code I have:
> class BuildingController < ApplicationController
> layout "standard"
> active_scaffold :building do |config|
> config.nested.add_link("Rooms", [:rooms])
> end
> end
> class RoomController < ApplicationController
> layout "standard"
> active_scaffold :room do |config|
> config.list.columns = [:name, :building,:operator]
> config.columns[:building].form_ui = :select
> config.columns[:operator].form_ui = :select
> end
> end
> class OperatorController < ApplicationController
> layout "standard"
> active_scaffold :operator do |config|
> config.list.columns = [:name]
> end
> end
> class Building < ActiveRecord::Base
> has_many :rooms
> end
> class Room < ActiveRecord::Base
> belongs_to :building
> belongs_to :operator
> end
> class Operator < ActiveRecord::Base
> has_many :rooms
> end
>
> Regards
> Andreas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---