0

I have a resource "Providers" that has a settings screen. I want to break that out into several screens for usability / design reasons. How should I manage that in my controllers to maintain good rails practice?

Is it acceptable to simply create new member actions for the controller (two per screen for the edit / update pairing) or is there a better / more accepted method?

4

1 回答 1

1

You could just continue to have 1 action/route and add logic inside of it to decide which partial to render. Something like this:

def edit
  @provider = Provider.find(params[:id])
  if params[:form][:basic_info]
    render 'basic_info'
  if params[:form][:additional_info]
    render 'additional_info'
end

I would stray away from multiple edit/updates because in my experience I have only ever seen it as a hinderance to DRY.

于 2013-06-18T23:20:23.800 回答