Comments (10)
Thanks for pointing this out. I'll sort this out later today.
from openmaize.
Awesome. I hope what I said made sense. It was kind of hard to word it. Thanks!
Sent from my iPhone
On Feb 16, 2016, at 8:45 PM, David Whitlock [email protected] wrote:
Thanks for pointing this out. I'll sort this out later today.
—
Reply to this email directly or view it on GitHub.
from openmaize.
Here are my versions:
{:phoenix, "~> 1.1.4"}, {:phoenix_ecto, "~> 2.0"}, {:postgrex, ">= 0.11.0"}, {:phoenix_html, "~> 2.3"}, {:phoenix_live_reload, "~> 1.0", only: :dev}, {:gettext, "~> 0.9"}, {:cowboy, "~> 1.0"}, {:openmaize, git: "https://github.com/elixircnx/openmaize.git"}, {:not_qwerty123, "~> 1.0"}]
I tested out the new version, and I'm getting a new error further in the process. Here is the stack trace:
Request: GET /dashboard/user_profiles/new ** (exit) an exception was raised: ** (UndefinedFunctionError) undefined function Openmaize.UserData.__schema__/2 (openmaize) Openmaize.UserData.__schema__(:association, :user_profile) (ecto) lib/ecto/association.ex:112: Ecto.Association.association_from_model!/2 (ecto) lib/ecto.ex:468: Ecto.build_assoc/3 (app) web/controllers/user_profile_controller.ex:24: app.userProfileController.new/3 (app) web/controllers/user_profile_controller.ex:1: app.userProfileController.action/2 (app) web/controllers/user_profile_controller.ex:1: app.userProfileController.phoenix_controller_pipeline/2 (app) lib/phoenix/router.ex:261: app.Router.dispatch/2 (app) web/router.ex:1: app.Router.do_call/2 (app) lib/app/endpoint.ex:1: app.Endpoint.phoenix_pipeline/1 (app) lib/plug/debugger.ex:93: app.Endpoint."call (overridable 3)"/2 (app) lib/phoenix/endpoint/render_errors.ex:34: app.Endpoint.call/2 (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4 (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
Once build_assoc gets called, here is that function:
def build_assoc(%{__struct__: model} = struct, assoc, attributes \\ %{}) do 468 assoc = Ecto.Association.association_from_model!(model, assoc) 469 assoc.__struct__.build(assoc, struct, Dict.delete(attributes, :__meta__)) 470 end
This is the next step:
def association_from_model!(model, assoc) do 112 model.__schema__(:association, assoc) || 113 raise ArgumentError, "model #{inspect model} does not have association #{inspect assoc}" 114 end
That is where the error is encountered. Please excuse the line numbers inside the functions. Got to love copy and paste.
from openmaize.
Can you give me an example of a struct that does work with your example?
On an unrelated note, I've removed the :not_qwerty123 optional dependency - more details at #26.
from openmaize.
Looking at the ecto documentation, it seems that build_assoc needs the first argument to be a struct returned by Repo.get (or a similar function). Maybe if you create a struct by running user = Repo.get(User, current_user.id)
and send that to build_assoc, you might have more success.
from openmaize.
That's a good idea. I will give that a shot. If it doesn't cause any conflicts, I would like to keep notqwerty to enforce some basic password rules.
Sent from my iPhone
On Feb 17, 2016, at 11:15 PM, David Whitlock [email protected] wrote:
Looking at the ecto documentation, it seems that build_assoc needs the first argument to be a struct returned by Repo.get (or a similar function). Maybe if you create a struct by running user = Repo.get(User, current_user.id) and send that to build_assoc, you might have more success.
—
Reply to this email directly or view it on GitHub.
from openmaize.
I've just updated master to use the user_model in the :openmaize config (so it creates a struct from your User model combined with the information in the JSON Web Token). I think that will give you what you're looking for.
from openmaize.
Thanks for the quick turnarounds on this, but that fix didn't work. Its giving the same error. Its ok, I will just have to swap out auth frameworks so I can continue on.
from openmaize.
I'll look into it further and see what I can come up with.
from openmaize.
One option is for you to change data into a struct in the controller file - you can do this for just one function or, by overriding the action function, for all the functions in the module.
I think I'm going to change the current_user data back into a map, as this is probably the most flexible data structure to use, and the developers can convert it if they need to.
from openmaize.
Related Issues (20)
- How to translate short password validation? HOT 1
- add_confirm_token is missing on develop HOT 4
- Is this going to be deprecated? HOT 1
- Newbie question: How would you proceed on verifying the confirmation link? HOT 1
- Move mix phoenixauth generator to a separate installer, out of the hex package HOT 1
- Installer cannot find templates HOT 4
- Facebook, Twitter, ect... Oauth into Openmaize? HOT 3
- Add logging to login and email confirmation modules HOT 3
- Installer Generates API template for HTML site. HOT 2
- Remove the unique_id argument for the installer HOT 1
- Prevent sensitive information being sent on from Openmaize modules
- Installer not working HOT 2
- Password reset can't handle non existing email address HOT 4
- Provide two-factor authentication workflow guide HOT 2
- Support for Phoenix 1.3.0 file and directory structure conventions HOT 7
- Move repo and user_model values to the config HOT 3
- Disable confirmation HOT 2
- create both api auth for api's & session auth for html site HOT 7
- Remove hash_name and crypto_mod config values
- Spring cleaning / reorganization -- discussion HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openmaize.