I tried to make it an arbitrary URL using routing nesting

What is routing nesting?

Nesting routing. That way, you can put the parent controller name in the URL. It is also possible to acquire the id information of another model with which it is associated. Nesting is recommended when you want to transition to individual pages.

Nested routing method

ruby:routes.rb


resources :Parent controller do
    resources :Child controller
end

Enclose the child controller in do ~ end.

ex)

```ruby

 <% = link_to'chat room', class_room_messages_path (current_user.class_room.id)%>

Recommended Posts

I tried to make it an arbitrary URL using routing nesting
I tried to build an environment using Docker (beginner)
I tried to make an introduction to PHP + MySQL with Docker
I tried using Hotwire to make Rails 6.1 scaffold a SPA
[Unity] I tried to make a native plug-in UniNWPathMonitor using NWPathMonitor
I tried to make an Android application with MVC now (Java)
I want to make an ios.android app
After learning Progate, I tried to make an SNS application using Rails in the local environment
I tried to make a simple face recognition Android application using OpenCV
I tried to make an automatic backup with pleasanter + PostgreSQL + SSL + docker
I tried to make my own transfer guide using OpenTripPlanner and GTFS
I tried to make a talk application in Java using AI "A3RT"
I tried to develop an application in 2 languages
I tried to implement a server using Netty
[Rails] How to connect to an external API using HTTP Client (I tried connecting to Qiita API)
How to make an oleore generator using swagger codegen
I tried to operate SQS using AWS Java SDK
When making a personal app, I was wondering whether to make it using haml
I tried using TestNG
I tried using Galasa
I tried to make FizzBuzz that is uselessly flexible
App development beginners tried to make an Android calculator app
I tried using an extended for statement in Java
I tried to investigate the mechanism of Emscripten by using it with the Sudoku solver
roman numerals (I tried to simplify it with hash)
I tried to make an app that allows you to post and chat by genre ~ App overview ~
I want to build Java Applet without using an IDE
I tried to introduce UI animation to Pokedex using Poké API
I tried to build the environment little by little using docker
How to make an app using Tensorflow with Android Studio
I tried using Dapr in Java to facilitate microservice development
I tried to make a client of RESAS-API in Java
[Rails] I tried to implement "Like function" using rails and js
I tried to get started with Swagger using Spring Boot
[Android] [Library] I tried using an animation library called "Before After animation".
I tried using azure cloud-init
I tried using Apache Wicket
I tried using Java REPL
I tried to verify yum-cron
I tried to make it possible to set the delay for the UDP client of Android by myself
[Rails] Implementation of multi-layer category function using ancestry "I tried to make a window with Bootstrap 3"
Since the Rspec command is troublesome, I tried to make it possible to execute Rspec with one Rake command
I tried to integrate Docker and Maven / Netbean nicely using Jib
How to make an image posted using css look like an icon
I tried to build an http2 development environment with Eclipse + Tomcat
I tried to build a simple application using Dockder + Rails Scaffold
[Java] I tried to make a maze by the digging method ♪
Collatz number, Fibonacci number, triangular number I tried to make various sequence programs
Rails Tutorial Extension: I tried to create an RSS feed function
I tried to make Numeron which is not good in Ruby
I tried to display the calendar on the Eclipse console using Java.
I tried to make a group function (bulletin board) with Rails
I tried to make a sample program using the problem of database specialist in Domain Driven Design
I tried using anakia + Jing now
I tried to chew C # (indexer)
I tried using Spring + Mybatis + DbUnit
I tried using JOOQ with Gradle
I tried to summarize iOS 14 support
I tried to interact with Java
I tried to explain the method
I tried using Java8 Stream API