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

  • Home
  • SEARCH
  • 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 8238981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:59:21+00:00 2026-06-07T19:59:21+00:00

I am trying to accomplish something like this: I am creating a simple blog.

  • 0

I am trying to accomplish something like this:

I am creating a simple blog. I have set up categories for my blog.
I want that when my user goes to posts/index, he sees a list of all categories.

Example:
Text
Image

Upon clicking on a category, my user gets redirected to the posts/new page, where the category_id field will by transmitted through a hidden_field.

So my code right now is:

in posts/index

<% @categories.each do |c| %> 
  <%= link_to c.name, new_post_path(:category => c.id) %><br />
<% end %>

and in my posts/_form i’m trying to do something like this

<%= f.hidden_field :category_id, :value => params[:category_id] %>

which is not working though, because the html output is

No value is being passed.

What is the correct way to proceed here?
Thx!

  • 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-06-07T19:59:22+00:00Added an answer on June 7, 2026 at 7:59 pm

    At first glance it looks like a simple mistake mixing up the param names category and category_id.

    Try this:

    <% @categories.each do |c| %> 
      <%= link_to c.name, new_post_path(:category_id => c.id) %><br />
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to accomplish something like this: userSelectionIDs = [pref.selectionID for pref in UserColumnSelectionPreference.objects.filter(user=reqUser).all()]
Im trying to accomplish something like this. I want to add the text stored
I am trying to accomplish something like this: thread t; // create/initialize thread t.launch();
I am trying to accomplish something like this query: var query = from a
I currently have an XML Structure that looks something like this <Parent> <Info> <Info-Data></Info-Data>
I am trying to accomplish something like this. /* Code start */ function getCurrentTime()
I'm trying to accomplish something like this, var data = from p in db.Projects
I'm trying to accomplish something like this. I feel like it's possible, and if
I am trying to accomplish something like this var audios = $('audio'); for(var i
So I am trying to accomplish something like this: SELECT * FROM table WHERE

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.