Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:07:47+00:00 2026-05-24T03:07:47+00:00

I implemented the official Creating the Blog Application project as per the directions given.

  • 0

I implemented the official Creating the Blog Application project as per the directions given. But I am not getting the idea of link_to used in this project like:

<td><%= link_to 'Show', post %></td>
<td><%= link_to 'Edit', edit_post_path(post) %></td>
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>

given in app/views/posts/index.html.erb file, also corresponding code in app/controllers/posts_controller.rb for rendering html pages in app/views/posts/ directory.

If I want to render a new html page say index2.html.erb in app/views/posts/ directory that does not have ‘Edit’ and ‘Destroy’ links compared to index.html.erb, then how should I write link_to and corresponding code in posts_controller.rb ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:07:48+00:00Added an answer on May 24, 2026 at 3:07 am

    If you want an action called index2, say for a example URL like http://localhost:3000/posts/index2, then you need to:

    1. Create an action (method) for it in the posts_controller.rb:

      class PostsController < ApplicationController
        ...
        def index2
        end
        ...
      end
      
    2. Create a view file for it in the app/views directory called index2.html.erb

    3. Add a route to config/routes.rb, for example:

      resources :posts do
        member do
          get 'index2'
        end
      end
      

    To link to the newly created index2 page, add a link in some other html.erb file to it like this:

    link_to "index 2",index2_post_path
    

    I highly recommend the book Agile Web Development with Rails (Pragmatic Programmers)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented sherlockactionbar in my project and it works great, but I don't know
I am following the official tutorial to implement the FB credits but its not
I have implemented the official Spinner tutorial , but when I run it, the
I implemented my project for notification. I tested it in development Provisioning Profile (development
I implemented Forms authentication by creating Default.aspx and custom login page named login.aspx .
My application is an OpenGL heavily employed one, which is being used to process
I have implemented a simple XML parser using the official Android guide on the
I've just implemented a Java Web Start application, and I noticed one problem during
I was following integration steps from official FB documentation and have implemented login and
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.