I have a rails app where users
create projects
. Currently these are nested, and are completed as separate actions (A user
registers, and then from the project
dashboard creates a new project
).
To improve conversions (as well as track conversions from adwords and facebook) I want to create a new view called getting_started
whereby a user
will register and create a project
in one step from a single view.
In terms of best practice, should I create a new controller for this, rather than just slapping a new view in users
?
In my opinion better way is create another controller. Then you have better atomization of code. Which is easier to refactor. You can inherit this controller, and use
super
for creating user.You can think of
getting_started
as an alternative tousers#new
, so you could add it as a new action toUsersController
and add another action to respond to the POST and create a user with a nested project (I'm assuming you are filling in some form and that you are accepting nested attributes in yourUser
model).No need to create a new controller and inherit from it in my opinion.
I 'm not very experienced in this field but as far as I worked,
To create a new controller for a single function, i.e getting_started which is 100% related to an existing controller doesn't make sense. I 'll advise to place in the existing controller.
If we talk about efficiency, these will take exactly same time.