Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Access Rails form from different controller

Hi guys,

What is the best way to access any update and create actions from different place in Rails?

I want to move a lot of the User's actions to "Settings". What is the best way to set this up? For example - User has ProfilePhotos and I want to edit and create new ProfilePhoto in "/Settings".

I'd like to see just the basic process to make this(don't need a code here).

Thank you guys!

1 Answer

David Moore
David Moore
13,916 Points

You can route any resource action to any slug within your routes file. For example:

get "settings", to: ProfilePhotos#new

You can read more about the fine details of routing in the Rails Guides resource: http://guides.rubyonrails.org/routing.html