Skip to content

Supporting form_with in Rails 8.0 #32

Description

@jiko797torayo

Thank you for the wonderful gem✨

When I tried to upgrade a Rails application that using this gem to Rails 8.0, the following error occurred.

ActionView::Template::Error (Passed nil to the :model argument, expect an object or false)
Caused by: ArgumentError (Passed nil to the :model argument, expect an object or false)

Information for: ActionView::Template::Error (Passed nil to the :model argument, expect an object or false):
    1: <%= form_with url: '/search', id: 'form_with' do |f| %>
    2: <%= f.search_field :query, id: 'query' %>
    3: <% end %>

The cause is that the default value of the model: argument of form_with was changed from nil to false in Rails 7.2, and passing nil to the model: argument causes an error in Rails 8.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions