-2

I created custom routes '/album' that routes to 'microposts#new'. However, when I use a form_for it routes to '/micropost' instead of returning to '/album'.

In my controller I'm using render 'album'. I would prefer to keep as render, although I can make it work using redirect_to.

I know the problem is when I'm calling the create action in my micropost controller, it goes to /micropost instead of /album. Still new to rails and help would be appreciated.

Here is routes.rb:

  root 'pages#home'

  get '/album',       to: 'microposts#new'
  post '/album',      to: 'microposts#create'
Joseph Lee
  • 47
  • 7

1 Answers1

2

Add url: "/album" as an additional parameter in the form_for.

For additional options, see the doc.