{"action":"created","issue":{"url":"https://api.github.com/repos/asterite/rufo/issues/45","repository_url":"https://api.github.com/repos/asterite/rufo","labels_url":"https://api.github.com/repos/asterite/rufo/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/asterite/rufo/issues/45/comments","events_url":"https://api.github.com/repos/asterite/rufo/issues/45/events","html_url":"https://github.com/asterite/rufo/issues/45","id":238399545,"number":45,"title":"Question: Issue formatting non-identified hash parameters","user":{"login":"luislavena","id":4182,"avatar_url":"https://avatars1.githubusercontent.com/u/4182?v=3","gravatar_id":"","url":"https://api.github.com/users/luislavena","html_url":"https://github.com/luislavena","followers_url":"https://api.github.com/users/luislavena/followers","following_url":"https://api.github.com/users/luislavena/following{/other_user}","gists_url":"https://api.github.com/users/luislavena/gists{/gist_id}","starred_url":"https://api.github.com/users/luislavena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luislavena/subscriptions","organizations_url":"https://api.github.com/users/luislavena/orgs","repos_url":"https://api.github.com/users/luislavena/repos","events_url":"https://api.github.com/users/luislavena/events{/privacy}","received_events_url":"https://api.github.com/users/luislavena/received_events","type":"User","site_admin":false},"labels":[{"id":629991417,"url":"https://api.github.com/repos/asterite/rufo/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-25T19:10:43Z","updated_at":"2017-06-25T20:11:52Z","closed_at":null,"body":"Hello!\r\n\r\nTested against version `0.0.20` and using the defaults (no `.rufo` file) with Ruby `2.3.4`, encountered the following issue.\r\n\r\nGiven this source file:\r\n\r\n```ruby\r\nclass Collection < ActiveRecord::Base\r\n  has_attached_file :image, :styles => {\r\n      :thumb  => \"50x50#\",\r\n    },\r\n    :default_url => \"/images/:style/missing.png\"\r\nend\r\n```\r\n\r\nThe formatted output miss-align `:default_url` hash symbol given to `has_attached_file`:\r\n\r\n```ruby\r\nclass Collection < ActiveRecord::Base\r\n  has_attached_file :image, :styles => {\r\n                      :thumb => \"50x50#\",\r\n                    },\r\n                            :default_url => \"/images/:style/missing.png\"\r\nend\r\n```\r\n\r\nI assume this is caused since it attempts to align `:default_url` with `:styles`, but then the styles hash itself is aligned to the level of `:image` first parameter, which make it look weird.\r\n\r\nOne workaround is move these parameter to a second line, which then align properly with `:image`:\r\n\r\n```ruby\r\nclass Collection < ActiveRecord::Base\r\n  has_attached_file :image,\r\n                    :styles => {\r\n                      :thumb => \"50x50#\",\r\n                    },\r\n                    :default_url => \"/images/:style/missing.png\"\r\nend\r\n```\r\n\r\nWasn't sure if this expected or a bug, so opened just in case.\r\n\r\nThank you once again for releasing just a great tool! :heart: :heart: :heart: "},"comment":{"url":"https://api.github.com/repos/asterite/rufo/issues/comments/310925259","html_url":"https://github.com/asterite/rufo/issues/45#issuecomment-310925259","issue_url":"https://api.github.com/repos/asterite/rufo/issues/45","id":310925259,"user":{"login":"asterite","id":209371,"avatar_url":"https://avatars3.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"created_at":"2017-06-25T20:11:52Z","updated_at":"2017-06-25T20:11:52Z","body":"I found a way to fix it. The resulting code would look like this:\r\n\r\n```ruby\r\nclass Collection < ActiveRecord::Base\r\n  has_attached_file :image, :styles => {\r\n                              :thumb => \"50x50#\",\r\n                            },\r\n                            :default_url => \"/images/:style/missing.png\"\r\nend\r\n```\r\n\r\nAn alternative solution might be to format it like this:\r\n\r\n```ruby\r\nclass Collection < ActiveRecord::Base\r\n  has_attached_file :image, :styles => {\r\n                      :thumb => \"50x50#\",\r\n                    },\r\n                    :default_url => \"/images/:style/missing.png\"\r\nend\r\n```\r\n\r\nBut this later one is a bit harder to achieve.\r\n\r\nI think the first one is better because the hash contents are closer to the key (`:styles)`. What do you think?"}}
{"actor":{"display_login":"asterite"}}