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

User validation removed? #4

Open
stochastic-thread opened this issue Apr 24, 2015 · 2 comments
Open

User validation removed? #4

stochastic-thread opened this issue Apr 24, 2015 · 2 comments

Comments

@stochastic-thread
Copy link

Hey haha, I got your code working (I opened the last issue) but now I'm working through your tutorial (http://gogogarrett.sexy/programming-in-elixir-with-the-phoenix-framework-building-a-basic-CRUD-app/) and writing the code myself to learn Phoenix and Elixir. I have a solid background in Erlang but I'm having some trouble getting it to the current Phoenix version given the breaking changes...

In user.ex I had to change the line of code that is validate user, content: present() because I was getting this error:

Compiled lib/phoenix_first.ex

== Compilation error on file web/models/user.ex ==
** (CompileError) web/models/user.ex:8: undefined function validate/2
    (stdlib) lists.erl:1352: :lists.mapfoldl/3
    (stdlib) lists.erl:1353: :lists.mapfoldl/3

Upon investigation, I realized that it had (maybe?) been changed to: @required_fields ~w(content)

Moving right along, in your tutorial, you then use the User.validate(user) function but I don't know what to change it to given the change in the Phoenix framework that removes the validate function.

I tried to do a simple case match where I match on user, given my initial thought that the model is implicitly doing the validation (with the @required_fields ~w(content)) line of code, but I'm a little stuck.

Any advice?

Thanks very much!

You can find my progress building your tutorial applicaiton here:

https://github.com/arthurcolle/first_phoenix_web_app

@mackinleysmith
Copy link

I'm in the same position here and would greatly appreciate some insight.

@gogogarrett
Copy link
Owner

Sorry all - This project is very out of date, and so is the blog post. I will do my best to get this back up to date now that the christmas season is over.

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