ruby on rails - How should I structure controller actions that share templates? -
Assume that I have a user model, and a invoice Model related_to: user with association. Now I am creating a new action for my InvoicesController , and the scene will be sung, a selection of scenes for this user's selection- Element will be from this invoice. So I need to bring those users somewhere; My tendency is to leave out seeing this kind of thing, I end up with: def new @users = User.all end form Submit create . When creation fails for some reason, I render the view of the action of new action. def invoice = invoice. New Perm [: Invoice] If Invoice. Flash [: notice] = 'invoice created!' Redirect_to: Action => 'Show' ,: ID = & gt; Invoice.id other @ user = user.all render: action = & gt; The end of the 'new' end But as you can see, in order to reproduce the new action, I have to bring users back . This is just an example, but keep in mind that I have some forms with many select elements filled with database...