-
Notifications
You must be signed in to change notification settings - Fork 926
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
Move changeset comments feed to resourceful routes #4587
Move changeset comments feed to resourceful routes #4587
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a "one step forward, one step back" PR to me unfortunately.
There's two parts in moving to resourceful routing, one part is using resources
declaration in the routing file, but the other part is trying to have resourceful controller methods i.e. just index/show/new/create/edit/update/destroy , which the resources declarations use by default.
In #2050 (specifically 4b0d56f) I renamed the comments_feed
(which is what was used when the code was in changesets_controller) to the index
method, since that's what most closely aligns with what this doing i.e. showing a list of objects. So I'd like to keep this as a method named index
.
I realise that we still have feed
methods elsewhere, but those are targets for refactoring too. There's a difficulty when there are already index
methods that do different things (e.g. different lists of objects, or search filters, or other things, so in those cases it can't be as simple as just a respond_to
switch) but in those cases I would prefer to see e.g. FooController::index
and Foo::FeedController::index
or similar, i.e. the method name is still index
.
See http://jeromedalbert.com/how-dhh-organizes-his-rails-controllers/ for more info.
And I do the opposite thing in #4248 because I need the actual index path mapped to the actual index method.
Then that has to be done in all cases where feeds have their own paths. |
Yes, I think so. Unless there are alternative ideas - I'm willing to discuss options. |
bb1a192
to
58d4a8b
Compare
Renamed ChangesetCommentsController to ChangesetCommentsFeedsController and mapped it to a singular |
58d4a8b
to
06e6d15
Compare
06e6d15
to
67680fd
Compare
b16cb94
to
81907f3
Compare
70c5dd0
to
f56bbe5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in re-reviewing!
app/abilities/ability.rb
Outdated
@@ -16,7 +16,7 @@ def initialize(user) | |||
|
|||
if Settings.status != "database_offline" | |||
can [:index, :feed, :show], Changeset | |||
can :index, ChangesetComment | |||
can :show, :changeset_comments_feed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before, I don't think this is the correct action. This isn't a single object, it's a list of objects, so the method should be index
to reflect this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have easily argued for the opposite thing, which I'm not going to do because I just want to move feeds out of the way of #4248.
f56bbe5
to
4a38ab5
Compare
I've spent some time considering your point about whether we are But with everything related to So what I'm going to do is merge this PR, so that it unblocks your work, and then make my own followup PR for you to review. |
Changeset comments as nested resources of changesets. That gives path helper names like
feed_changeset_changeset_comments_path
. At first I tried renaming "changeset_comments" to just "comments", but that didn't work because there's also a feed of all changeset comments and it takesfeed_changeset_comments_path
.