My question here is in the proper manner of routing and controllers for my simple app. Honestly I got stuck with user model and post model.
I have been done this way:
match / dashboard, for: 'dashboard # user'
UID takes the session to find the user and his post in the controller (posts and user profile is completely private to the user) so far the dashboard completes its purpose. The question is where do I go from here? Posts are shown in the same view as the list. I would like to make my routes as / dashboard / posts /: id
for editing / updating and creating.
This will point me to using a resource at the end: using the scope '/ dashboard'
or path: '/ dashboard / post'
Is a good way, or is it against "railway route"? Or is I completely mistaken that what is happening here?
I am completely scared of messing up the code and repeating again and again (as certification, keeping the routes clean and clear). / P>
You can either use it or, such as:
Namespace
# config / routes.rb Namespace: To root the dashboard: "user # index" resource: post, comments #interval / app / controller / dashboard / User_controller rb class user controller & lt; Dashboard :: ApplicationController.rb end
nested
# config / routes.rb Processing: user, path : "Dashboard", as such: "Dashboard" does the resource: End of ad
Comments
Post a Comment