Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boxer.ship_all Method for Collections #2

Open
h3h opened this issue Nov 17, 2011 · 4 comments
Open

Boxer.ship_all Method for Collections #2

h3h opened this issue Nov 17, 2011 · 4 comments
Labels

Comments

@h3h
Copy link
Member

h3h commented Nov 17, 2011

Boxer.ship_all(:course, Course.all, :root_key => 'my_courses')
@ghost ghost assigned h3h Nov 17, 2011
@h3h h3h mentioned this issue Nov 17, 2011
@i-arindam
Copy link

What is the last parameter supposed to mean, some kind of condition?
Or will it also be of the kind
:view => 'view_name

@h3h
Copy link
Member Author

h3h commented Dec 4, 2011

Good question. The intention is for the last argument to be a hash just like with ship, but it'll recognize two special keys instead of one: root_key in addition to view.

The value of root_key would be used as the name of the key in the resulting hash. under which the array of shipped objects would be placed, e.g.

{
  "my_courses": […]
}

The rest of the pairs in that last argument hash would be sent along to each box, just as with ship.

@kevinelliott
Copy link

This looks like a good solution. Would be nice to include some additional values at the top level, such as for paging (per_page, page, results (a count)).

Any suggestions on how to implement this until Boxer ship_all is included?

@venkatd
Copy link

venkatd commented Jul 12, 2012

I wrote my own simple version of ship-all

class Boxer

  def self.ship_all(type, objects, *args)
    objects.map { |o| Boxer.ship(type, o, *args) }
  end

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants