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

Kalecto.Model macro usage #2

Closed
djm opened this issue Apr 19, 2015 · 4 comments
Closed

Kalecto.Model macro usage #2

djm opened this issue Apr 19, 2015 · 4 comments

Comments

@djm
Copy link

djm commented Apr 19, 2015

Hi,

First off, thanks very much for your work on these datetime packages. Super, super useful.

I'm still relatively new to Elixir but I am confused by the instructions in the README:

In your Ecto models, where you have a schema definition with a timestamps line, add use Kalecto.Model at the top of the module, below the line that says use Ecto.Model

When using both use lines in an Ecto model definition, compilation seems to raise this warning:

model.ex:1: warning: this clause cannot match because a previous clause at line 1 always matches

...and looking at the macro code itself, it seems to declare use Ecto.Model for you.

So I guess the question is, am I missing a reason for asking users to specify both lines?

cheers,
Darian

@lau
Copy link
Owner

lau commented Apr 19, 2015

Hi Darian. I'm glad you find it useful.

You are right, it should work if you only use this line: use Kalecto.Model

As far as I remember I thought it would be less confusing with both lines. But I guess it isn't. And it's redundant. So the answer is that there is no good reason that the readme says that :) I'll fix it.

Thanks for the feedback. The documentation for Kalecto is lacking because the other packages (kalends and tzdata) have had a higher priority, but eventually it should improve.

@djm
Copy link
Author

djm commented Apr 19, 2015

Awesome, thanks for clearing that up.

@lau lau closed this as completed Apr 19, 2015
@lau
Copy link
Owner

lau commented Apr 29, 2015

@djm FYI for the newest version (0.3.1) I have gone back to having both lines (use Ecto.Model and use Kalecto.Model). The line that caused the compilation error was redundant as is no longer there.

I think it makes more sense this way with both lines

@djm
Copy link
Author

djm commented Apr 30, 2015

@lau cool, thanks for the headsup.

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

2 participants