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

How to use Exquisite selector? #28

Open
eraserewind opened this issue Sep 25, 2014 · 2 comments
Open

How to use Exquisite selector? #28

eraserewind opened this issue Sep 25, 2014 · 2 comments

Comments

@eraserewind
Copy link

Hi,

I'm having an issue using the exquisite selector. I've written this code, from the README section:

    Amnesia.transaction do
      existing_user = User.where(email == new_mail, select: id) |> Amnesia.Selection.values
      existing_user
    end

My table user: deftable User, [ :id, :email, :name, :password ], type: :ordered_set, index: [:email]

At compilation time i'm getting this error:

== Compilation error on file lib/mnesia.ex ==
** (CompileError) lib/mnesia.ex:51: function email/0 undefined
    (stdlib) lists.erl:1336: :lists.foreach/2
    lib/mnesia.ex:31: (module)

What I am missing? Thanks!

@cjimison
Copy link
Contributor

cjimison commented Jul 9, 2015

This is kind of an old question but I figured I would give it a response just because I hit a similar issue.

Try changing it to

      existing_user = User.where(email == new_mail, select: id)
      existing_user  |> Amnesia.Selection.values

I think exquisite is doing some macro programming funness and gets confused when you try to pipe or do other operations besides just the "where" call.

@vitaliel
Copy link

For me it worked when I added require statement:

  require Amnesia
  require Database.User
  require Exquisite

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

No branches or pull requests

3 participants