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

Undefined local variable or method form while updating tasks from admin panel #162

Open
nickskalkin opened this issue Sep 11, 2017 · 4 comments

Comments

@nickskalkin
Copy link
Contributor

Steps to reproduce:

  1. Login as admin
  2. Tasks -> Edit
  3. Clear Md body field (so task will be not valid)
  4. Click on Update button
NameError: undefined local variable or method `form' for #<Hanami::View::Rendering::Scope:0x007fcd04857d60> Did you mean? format form_for fork

/Users/nikita/.rvm/gems/ruby-2.3.0@ossboard/gems/hanami-view-1.0.0/lib/hanami/view/rendering/layout_scope.rb:221:in `method_missing'
/Users/nikita/.rvm/gems/ruby-2.3.0@ossboard/gems/hanami-view-1.0.0/lib/hanami/view/rendering/scope.rb:73:in `method_missing'
/Users/nikita/Projects/ossboard/apps/admin/templates/tasks/edit.html.slim:3:in `block in singleton class'
@nickskalkin
Copy link
Contributor Author

nickskalkin commented Sep 11, 2017

As I can see, this behaviour spreads all over across admin panel, at least at /admin/users/ , /admin/tasks

@davydovanton
Copy link
Member

davydovanton commented Sep 12, 2017

thanks for report! could you try to solve this bug?

@nickskalkin
Copy link
Contributor Author

sure

@nickskalkin
Copy link
Contributor Author

I've done temporary fix, there is no 500 more, but we should decide how to handle fields that not passed validation. Should I show flash with errors on top of the page or highlight every field, like Simple Form does?
Also, I'm a bit stuck, may be you can advice me something and I will not spent extra time looking for a solution. The point is that when we update tasks/users in Update action, if operation is not successful we remain in the Update action, so we need method form in Update view. But the form will be 90% the same as in the Edit view. So where should I extract this method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants