Overriding display / editing / etc behavior in ActiveScaffold

I currently have a generic list created by ActiveScaffold. At the end of each line in the list, ActiveScaffold adds standard CRUD links - Show, Edit, Delete - for each entry.

I do not want to use ActiveScaffold for these actions (long story) and created my own controllers to handle this. I am trying to override these links to point to my own controllers, but I cannot figure out how to get through the post id.

For example, I want the new link for Show to be / foo / show / [id] . I have this in my ActiveScaffold configuration:

config.show.link.action = "show"
config.show.link.parameters = {:controller => "foo", :id => ???}

I do not know what to pass through the id parameter . I tried using things like: foo_id or foo_id, but the controller does not know what it is. When I use: foo_id, for example, I just get the line - / foo / show / foo_id .

My controller is lower, but not many.

class MessagesController < ApplicationController

    active_scaffold :messages do |config|

        config.columns = [:eff_date, :exp_date, :type, :message]

        config.show.link.action = "show"
        config.show.link.parameters = {:controller => "show_messages", :id => ??}

    end

end

I would like to use ActiveScaffold for the list screen, because I really do not want to roll my version of the listing. I found a guy asking the same question on googlegroups but there was no answer.

http://www.mail-archive.com/ activescaffold@googlegroups.com /msg00798.html

Edit: I have to add that without specifying the parameter: id actually puts the default ActiveRecord ID in the field, but it's not exactly the one I want - again, a long story ... :(

+3
1

, , , , .

"": , . ActiveScaffold URL , ( , ).

- - , , , ActiveRecord, ... d'oh.

+1

Source: https://habr.com/ru/post/1769068/


All Articles