<\/code> via the ERB tag. This tag serves as an integration point for containing view content dynamically rendered by Rails; <\/li>\n<\/ul>\n<\/details>\n
Generate a test page using the pages<\/code> controller and the html_test_1<\/code>, html_test_2<\/code>, html_test_3<\/code> and html_test_4<\/code> actions<\/h3>\nExpand…<\/summary>\n```bash\n$ rails g controller pages html_test_1 html_test_2 html_test_3 html_test_4\n create app\/controllers\/pages_controller.rb\n route get \"pages\/html_test_1\"\n get \"pages\/html_test_2\"\n get \"pages\/html_test_3\"\n get \"pages\/html_test_4\"\n invokeerb\n create app\/views\/pages\n create app\/views\/pages\/html_test_1.html.erb\n create app\/views\/pages\/html_test_2.html.erb\n create app\/views\/pages\/html_test_3.html.erb\n create app\/views\/pages\/html_test_4.html.erb\n invoke helper\n create app\/helpers\/pages_helper.rb\n```\n
\n
Since routes are also added when creating controllers and actions, any created actions can be accessed via the following link: <\/li>\n
Use VSCode to open the config\/routes.rb<\/code> file<\/h3>\n
\n
Add the following lines at the end of the file to direct the page root to the pages<\/code> controller and html_test_1<\/code> action created earlier. This way, when accessing your website or system, the first page displayed will be the pages<\/code> controller's html_test_1<\/code> page. Otherwise, Rails' default page will be displayed. <\/li>\n<\/ul>\n
If the --skip-routes<\/code> parameter is passed when creating the controller, you can ignore adding routes for the created action.The complete command will become rails g controller pages html_test_1 html_test_2 html_test_3 html_test_4 --skip-routes<\/code><\/li>\n<\/ul>\n<\/details>\n
Show Rails routes<\/h3>\nExpand…<\/summary>Using the terminal, you can specify a controller (using `-c`) to display the route, for example the `pages` controller:\n
$ rails -v\nRails 8.0.0\n\n$ time rails new classless-css-tailwind\n...\nreal 0m47.500s\nuser 0m33.052s\nsys 0m4.249s<\/code><\/pre>\n
Alternatively, you can use the following command to display all routes: <\/p>\n
$ cd classless-css-tailwind && code .<\/code><\/pre>\n
\n
You can also access the route through your browser using the address http:\/\/127.0.0.1:3000\/rails\/info\/routes<\/code>. Don't forget to start the development server using bin\/dev<\/code> or standard rails server<\/code> in the project root. The development server \"listens\" for changes to JavaScript files and CSS files to perform the necessary processing to serve them to the user. <\/li>\n
In order for changes to these files to be immediately executed and viewed in the browser, a gem like Rails Live Reload needs to be installed. <\/li>\n<\/ul>\n<\/details>\n
We will create four pages with HTML content to test CSS styles. <\/h3>\n
Ruby on Rails uses the MVC (Model-View-Controller) architecture by default to initiate project organization. Most of the code is organized in the following folders: <\/p>
\n
Code related to domain\/business logic and data should be kept in the app\/models<\/code> folder; <\/li>\n
Display related code (HTML, JSON, XML, etc.) will be located in the app\/views<\/code> folder; <\/li>\n
Code related to the request lifecycle will be located in the app\/controllers<\/code> folder; <\/li>\n<\/ul>\n
Insert the content of the html_test_1<\/code> page<\/h3>\nExpand…<\/summary>- Visit the link https:\/\/github.com\/dbohdan\/classless-css\/blob\/master\/screenshot-page.html and copy all the content inside the `` tag, As shown below\n
$ rails -v\nRails 8.0.0\n\n$ time rails new classless-css-tailwind\n...\nreal 0m47.500s\nuser 0m33.052s\nsys 0m4.249s<\/code><\/pre>\n<\/details>\n
Insert the content of the html_test_2<\/code> page<\/h3>\nExpand…<\/summary>- Visit the link https:\/\/gist.github.com\/tommaitland\/5865229 and copy all content inside the `