Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Ability to pass an arguments hash to the materialize class method #6

Merged
merged 1 commit into from

2 participants

@jaywengrow

Firstly, thanks for your great gem!

We're using Faceted in a project that doesn't use a classical ORM that supports methods such as 'where', etc. and thus we call the materialize method straight from our controller, as in:

Musician.materialize(results)

and want to be also be able to pass in an 'excludes' hash, as you currently allow when simply creating a new presenter. So, we'd like to be able to do something like this:

Musician.materialize(results, :excludes => [:id])

This pull request allows the passing of such an argument hash.

Thanks!

@CoralineAda CoralineAda merged commit 3bab786 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 12, 2013
  1. @jaywengrow

    give the ability to pass args hash to materialize which allows for th…

    jaywengrow authored
    …e option of having presenters not present id
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/faceted/model.rb
View
4 lib/faceted/model.rb
@@ -44,9 +44,9 @@ def fields
@fields ||= [:id, :excludes]
end
- def materialize(objects=[])
+ def materialize(objects=[], args={})
objects.compact.inject([]) do |a, object|
- interface = self.new
+ interface = self.new(args)
interface.send(:object=, object)
interface.send(:initialize_with_object)
a << interface
Something went wrong with that request. Please try again.