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

[BUG] create action broken #296

Open
Anonyfox opened this issue Sep 30, 2023 · 3 comments
Open

[BUG] create action broken #296

Anonyfox opened this issue Sep 30, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Anonyfox
Copy link

Versions Used
Kaffy: 0.10.3
Phoenix: latest
Elixir: latest

What's actually happening?

when creating a new record via the form, when I enter valid data and click save, I get an error expected a map, got: nil from lib/kaffy/resource_error.ex:52, unfortunately there is nothing helpful in the stacktrace. I digged a little and put

def create_changeset(schema, attrs) do
    dbg(schema)
    dbg(attrs)
    ...
end

into the callchain, and while the schema is the correct struct (albeit empty), the attrs are an empty map - my data should be in there, no?

What should happen instead?

I click create and it creates the resource

Screenshots
If applicable, add screenshots to help explain your problem.

Bildschirmfoto 2023-09-30 um 23 09 08

(the attribute in my schema is called :name if it helps.)

@Anonyfox Anonyfox added the bug Something isn't working label Sep 30, 2023
@aesmail
Copy link
Owner

aesmail commented Oct 5, 2023

@Anonyfox can you share more information about the field itself (field type, defaults, etc) and what value did you try to enter in kaffy?

@Anonyfox
Copy link
Author

Anonyfox commented Oct 7, 2023

Thats the schema:

  schema "owners" do
    field :name, :string
    field :state_name, :string
    field :street_name, :string
    field :street_number, :string
    field :zipcode, :string
    field :city_name, :string
    field :district_name, :string
    field :latitude, :float
    field :longitude, :float

    # every company can have a mother company
    belongs_to :owner, __MODULE__

    timestamps()
  end

the only required field is name (no additional validation except for validate_required([:name]) and I entered random strings

@aesmail
Copy link
Owner

aesmail commented Oct 8, 2023

@Anonyfox based on the POST url, I think the issue is that the resources config option is the cause of the issue. If you are setting the resources manually, try using owner instead of owners under the partner key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants