Skip to content

Is it possible to use form_for with Her? #482

@samstarling

Description

@samstarling

Hello. Is there a recommended way of using form_for with Her? If I just use it, then I get the following error:

undefined method `foo_clients_path' for #<#<Class:0x007fadcfd0aed8>:0x007fadd04bdae0>

Foo is the name of my module with the Her models in (so I have Foo::Client.new in the controller. I guess this makes sense because it can't resolve the path, but if I pass in a url parameter to form_for, it then starts choking on the field names:

# This code
<%= form_for(@client, url: 'foo') do |f| %>
  <%= f.text_field :name %>
  <%= f.submit "Create" %>
<% end %>

# Gives this exception
undefined method `name' for #<Foo::Client(clients) >

Any advice on how to do this would be much appreciated - I saw on other issues that folks seem to successfully be using form_for, but maybe I missed something. Thanks!

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