mardi 4 août 2015

How can I call a method within active_scaffold?

I can't seem to find any questions similar to this that have been asked. Maybe this means I am way off and this is a dumb question.

I am trying to add a feature to a preexisting app. This feature allows the user to copy a report over to the next period (a fiscal year).

Here is the abridged active_scaffold code:

active_scaffold :report do |config|
  config.list.columns = [:user, :period, :division, :released, :reportable, :comp_plan]
  config.create.columns = [:user, :period, :division, :released, :reportable, :comp_plan]
  config.update.columns = [:user, :period, :division, :released, :reportable, :comp_plan]

  config.actions.exclude :show

  config.columns[:user].form_ui = :select
  config.columns[:period].form_ui = :select

  config.columns[:user].clear_link
  config.columns[:period].clear_link

  config.columns[:user].search_sql = ["users.first_name", "users.last_name"]
  config.search.columns << :user

  config.nested.add_link :access_rights, :label => 'Access'
end

Now I want to add a link to each row which calls a function which copies that report.

Any ideas are greatly appreciated.

Edit: Most of the code probably isn't relevant to the question but I figure it would be helpful to see anyways.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire