macfanatic/active_admin — comment on commit 5c693a0c6895504fcbf8840b56141dc47db8b8a2
File:  line 0
By macfanatic:

All makes sense, although I'm super disappointed in just providing an array of IDs to the user. All in all, no big deal, it just had a certain wow factor when receiving an array of AR models.

In any event, I actually sat down tonight to work on change requests, so I'll get working on this along with rebasing off the latest!

On Nov 30, 2011, at 6:44 PM, Matt Vague wrote:

> Sweet so I talked to Greg and he's really excited about this feature. We went over the code together and pretty much everything is good to go except for a few things.
>
> I'm just going to write the feedback here because I dont really want to look through commits to find the right files :-)
>
> 1. We will soon be adding the ability to use ORMs other than ActiveRecord (MongoDB, etc). This means that we need to shift away from anything ActiveRecord-specific like `resource_class.find` in `register_batch_action_handler`. Instead of doing the object lookup *for* people we should just pass them the array of IDs that were selected and let them iterate through the IDs. (see an example below)
> 2. Could we change `sort_order` to `priority`? It'd be nice to have consistency with other AA components like `menu_item.rb`
> 3. Could we move batch actions form stuff out of the `page_content` method of `index.rb` and into an AA component? (see below)
>
> Other than that we're looking great! I still want to do a bit of JS refactoring and stuff so I think instead of you issuing a pull request, I will just pull your stuff, make my changes and then merge into master.
>
> Does that all make sense? Tell me if you need clarification
>
> -
>
> #**1** Continued
>
> Instead of
>
> batch_action :do_something |selection|
> selection.each do |item|
> item.destroy
> end
> end
>
> You would do
>
> batch_action :do_something do |selected_ids|
> Post.find(selected_ids).each do |post|
> post.do_something
> end
> end
>
>
> #**4** Continued
>
> Instead of
>
> text_node(form_tag active_admin_config.batch_action_path, :id => "collection_selection")
> # Table stuff here
> text_node('

'.html_safe)
>
> You would be able to do
>
> batch_action_form do
> # Table stuff here
> end
>
> And `batch_action_form` would be an AA Component that would handle wrapping the table in a form and do whatever else is needed.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/macfanatic/active_admin/commit/5c693a0c6895504fcbf8840b56141dc47db8b8a2#commitcomment-759587