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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meetings registrations admin form #2202

Merged
merged 3 commits into from
Nov 15, 2017

Conversation

mrcasals
Copy link
Contributor

馃帺 What? Why?

The admin meeting registrations form was not working properly when a validation error was raised and the user tried to resubmit the form. This PR ensures it works as expected.

When submitting a form without specifying the method (PATCH for update or POST for create), Rails deduces the method it needs to use by checking if the object that is used in the form responds to to_param. If it does and returns a significant value, then it will use PATCH to update the resource, if it doesn't then it means we're creating the resource and thus it will use POST.

Our form was correctly returning a significant value the first time we render the form, but if we get an error message then it wouldn't return a significant value. This is due to how we generate the form object and internals of rectify, the gem we're using to handle the form objects.

The fix ensures the to_param method of the form object will always have a significant value, as it calls the id method internally:

https://github.com/andypike/rectify/blob/dd77495f6d763bd28515b44e8b00af09562e0095/lib/rectify/form.rb#L86-L88

馃搶 Related Issues

@codecov
Copy link

codecov bot commented Nov 15, 2017

Codecov Report

Merging #2202 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
+ Coverage   98.59%   98.59%   +<.01%     
==========================================
  Files        1186     1186              
  Lines       27385    27388       +3     
==========================================
+ Hits        27000    27003       +3     
  Misses        385      385

@mrcasals mrcasals changed the title Meetings/fix registrations admin form Fix meetings registrations admin form Nov 15, 2017
@mrcasals mrcasals merged commit 829fd8b into master Nov 15, 2017
@mrcasals mrcasals deleted the meetings/fix-registrations-admin-form branch November 15, 2017 09:14
@ghost ghost removed the in-review label Nov 15, 2017
mrcasals added a commit that referenced this pull request Nov 15, 2017
* Ensure admin meeting registrations form has an ID

* Add CHANGNELOG entry

* Add docs
@mrcasals mrcasals mentioned this pull request Nov 15, 2017
mrcasals added a commit that referenced this pull request Nov 22, 2017
* Fix meetings registrations admin form (#2202)

* Ensure admin meeting registrations form has an ID

* Add CHANGNELOG entry

* Add docs

* Bump version

* Bump docker image version on CircleCI

* Use latest docker image (#2212)

* Use alpine

* Fix builds

* Fix build

* Fix image building

* Launch CI run

* Use bundle

* Fix build

* Fix alpine build

* Bundle install

* Don't cache

* Try to fix build

* Fix workspace persisting

* Fix generator specs

* Use the last released image

* Use the latest image

* Use the latest image to run tests

* Use dev image

* Add npm dependencies

* Revert changes on bundle.js

* Use caching

* Add caching

* Revert changes on the generator spec

* Fix comments

* Trigger build

* Trigger build

* Fix specs

* Solve it in a different way

* Fix test app generation

* Migrate to headless chrome (#2157)

* "main" does not depend on "test_app"

* Remove unnecessary ignores

* Create a testing docker image

And bundle test dependencies in there.

* Consistent docker arguments

* Change working dir in Circle CI

So that it uses the folder where decidim lives in the image.

* Remove & simplify some folder changes

* Migrate to headless chrome

* No need to time things anymore

Workflows do this for us.

* Enable FAIL_FAST in CI

* Remove unnecessary apt-get update

Nodejs installation does it already.

* Npm dependencies should be installed "in folder"

So they can be used in tests without reinstalling again.

* Push a test-latest image for now

So that we can later add caching.

* Precompile assets in test app

* Use cache for test image as well

* Completely ditch phantomjs & poltergeist

* Fix task

* Preparation for headless chrome (#2147)

* Reuse shared spec

* Use rack_test for specs that use lower lever stuff

Since not all js drivers implement status codes and so on.

* Remove unused polyfill

* Explicit confirmation of modals

Since not all drivers auto-accept them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meetings: enable registrations on meeting raises error
2 participants