On 07/29/11 - 04:06:10PM, Tomas Sedovic wrote:
On 07/29/2011 03:19 PM, Chris Lalancette wrote:
> On 07/29/11 - 01:19:26PM, Tomas Sedovic wrote:
>> On 07/29/2011 12:27 PM, Chris Lalancette wrote:
>>> Taking a quick look around the code, it doesn't seem like we need
>>> rack-restful_submit gem anymore. Is that true? If so, I would like to
>>> it from the Gemfile and the specfile, but I wanted to make sure I
>>> missing anything before doing that.
>> Hey Cris,
>> The scenario for restful_submit is this: you have a list of stuff with
>> checkboxes. You can select multiple items and run several actions on all
>> of them at once.
>> We give you a list of deployments and you'd like to select 4 of them
>> that are running and stop them. Or select the 5 that are down and
>> restart them. Or delete them.
>> Or like the Gmail interface.
>> Once we have more than one such action (stop/restart/delete/whatever),
>> (which we do).
>> Currently, we don't have that situation in the UI, so we could remove it
>> now and put it back once that need arises.
>> However, we do use the `restful_submit_tag` helper in our views, so
>> ditching the gem would mean rewriting the forms to use regular submit
> Right, thanks for the explanation. There is still something I don't
> understand, though. If you look in (say)
> src/app/views/pool_families/_list.haml, you do indeed see a reference to
> restful_submit_tag. But then if you look in
> src/app/helpers/application_helper.rb, you'll see that restful_submit_tag is
> defined in there.
> So it would seem to me that we already have that functionality in our codebase,
> and we don't need the external gem. What am I missing?
It's a bit more complicated.
All the helper does is add some hidden params to the "restful action
buttons" in our views/generated html.
The restful_submit gem provides a Rack middleware that translates these
params to appropriate controller actions.
It's very similar to using `_method="put"` in an HTML form and have
Rails understand that as a HTTP PUT request.
If we drop the gem but keep Conductor untouched, there will be no
errors, but the restful_submit_buttons will not behave correctly.
Ah, OK. That was the bit I was missing.
OK, so I'll make sure to enable that gem in the Gemfile for now. We can
investigate whether we should remove it completely once things have settled
down a bit more.