{"action":"created","issue":{"url":"https://api.github.com/repos/sul-dlss/argo/issues/580","repository_url":"https://api.github.com/repos/sul-dlss/argo","labels_url":"https://api.github.com/repos/sul-dlss/argo/issues/580/labels{/name}","comments_url":"https://api.github.com/repos/sul-dlss/argo/issues/580/comments","events_url":"https://api.github.com/repos/sul-dlss/argo/issues/580/events","html_url":"https://github.com/sul-dlss/argo/issues/580","id":136130337,"number":580,"title":"Separate workflow actions in ItemsController","user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-24T17:30:37Z","updated_at":"2016-02-25T15:08:49Z","closed_at":null,"body":"While trying to debug the feature spec for workflow_service_create, try using this:\r\n```\r\nexpect_any_instance_of(ItemsController).not_to receive(:add_workflow)\r\nvisit add_workflow_item_path item.pid\r\n```\r\nIt blows up.  This means the UI display is calling that method to create the display before any form is submitted, I think. (edited)\r\n\r\nSo I think that means this method is taking on the responsibility of both a `new` and a `create` action, maybe?  At a guess, wondering whether the workflow actions need to be broken out into a separate controller from the `ItemsController`?\r\n\r\nOr at least two actions like `ItemsController#workflow_new` and `ItemsController#workflow_create`? \r\nOther controller methods are `ItemsController#workflow_*`, i.e.\r\n```\r\n$ ack-grep 'def.*workflow' app/controllers/items_controller.rb \r\n  def workflow_history_view\r\n  def workflow_view\r\n  def workflow_update\r\n  def add_workflow\r\n```\r\n\r\nChecking params on each call to the existing `ItemsController#add_workflow`:\r\n\r\nOn `new` it has only:\r\n```\r\n> params\r\n=> {\"controller\"=>\"items\", \"action\"=>\"add_workflow\", \"id\"=>\"druid:hj185vb7593\"}\r\n```\r\n\r\nOn `create` (or ‘Add’ button click), it has:\r\n```\r\n> params\r\n=> {\"utf8\"=>\"✓\", \"wf\"=>\"accessionWF\", \"controller\"=>\"items\", \"action\"=>\"add_workflow\", \"id\"=>\"druid:hj185vb7593\"}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/sul-dlss/argo/issues/comments/188827796","html_url":"https://github.com/sul-dlss/argo/issues/580#issuecomment-188827796","issue_url":"https://api.github.com/repos/sul-dlss/argo/issues/580","id":188827796,"user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T15:08:49Z","updated_at":"2016-02-25T15:08:49Z","body":"I submit there *should* be separate controller actions for `new` vs. `create` in any Rails app.  The use of one parameter check, i.e. `return unless params[:wf]`, in one method to differentiate these actions is not at all clear as to it's purpose and the meaning of the method as a whole.  I argue that this method *should* be broken up into something like `object_workflow_new` and `object_workflow_create`."}}