{"action":"opened","issue":{"url":"https://api.github.com/repos/OpenSCAP/foreman_openscap/issues/50","labels_url":"https://api.github.com/repos/OpenSCAP/foreman_openscap/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/OpenSCAP/foreman_openscap/issues/50/comments","events_url":"https://api.github.com/repos/OpenSCAP/foreman_openscap/issues/50/events","html_url":"https://github.com/OpenSCAP/foreman_openscap/issues/50","id":54572786,"number":50,"title":"Validation of policy attributes works only in wizard","user":{"login":"ares","id":109773,"avatar_url":"https://avatars.githubusercontent.com/u/109773?v=3","gravatar_id":"","url":"https://api.github.com/users/ares","html_url":"https://github.com/ares","followers_url":"https://api.github.com/users/ares/followers","following_url":"https://api.github.com/users/ares/following{/other_user}","gists_url":"https://api.github.com/users/ares/gists{/gist_id}","starred_url":"https://api.github.com/users/ares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ares/subscriptions","organizations_url":"https://api.github.com/users/ares/orgs","repos_url":"https://api.github.com/users/ares/repos","events_url":"https://api.github.com/users/ares/events{/privacy}","received_events_url":"https://api.github.com/users/ares/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-16T12:58:58Z","updated_at":"2015-01-16T12:58:58Z","closed_at":null,"body":"If we create a policy through wizard validations make sure that we input valid data based on current `step_index`. When we edit policy later through edit action, `step_index` is always 1 so validations like [this](https://github.com/OpenSCAP/foreman_openscap/blob/488eec978f2f6f57aa0be26c8312fd8a4b4e6fb4/app/models/concerns/foreman_openscap/policy_extensions.rb#L27) are ignored.\r\n\r\nThe issue origin is in  [`wizard_completed?` method](https://github.com/OpenSCAP/foreman_openscap/blob/488eec978f2f6f57aa0be26c8312fd8a4b4e6fb4/app/models/concerns/foreman_openscap/policy_extensions.rb#L89) which detects whether `current_step.blank?`. Current step can't be blank since it's defined as [`@current_step || steps.first`](https://github.com/OpenSCAP/foreman_openscap/blob/488eec978f2f6f57aa0be26c8312fd8a4b4e6fb4/app/models/concerns/foreman_openscap/policy_extensions.rb#L65)"}}