Skip to content

Commit

Permalink
fix: via_resource_class on belongs_to fields (#2091)
Browse files Browse the repository at this point in the history
* fix: `via_resource_class` on `belongs_to` fields

* test
  • Loading branch information
Paul-Bob authored Dec 8, 2023
1 parent 507a489 commit 51b4e09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/components/avo/fields/has_one_field/show_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def create_path
args = {
via_relation: association_id,
via_relation_class: @resource.model_class.to_s,
via_resource_class: @resource.class,
via_record_id: @resource.record.to_param,
via_association_type: :has_one
}
Expand Down
2 changes: 1 addition & 1 deletion spec/features/avo/create_has_one_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

click_on "Create new main post"

expect(page).to have_current_path("/admin/resources/posts/new?via_association_type=has_one&via_record_id=#{user.slug}&via_relation=user&via_relation_class=User")
expect(page).to have_current_path("/admin/resources/posts/new?via_association_type=has_one&via_record_id=#{user.slug}&via_relation=user&via_relation_class=User&via_resource_class=Avo%3A%3AResources%3A%3AUser")
expect(page).to have_text user.name

fill_in "post_name", with: "Main post name"
Expand Down

0 comments on commit 51b4e09

Please sign in to comment.