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 9031015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:37:51+00:00 2026-06-16T07:37:51+00:00

Why do I get error like this? undefined method `community_topics_path’ for #<#<Class:0x00000009d79098>:0x00000009d70a38> Extracted source

  • 0

Why do I get error like this?

undefined method `community_topics_path' for #<#<Class:0x00000009d79098>:0x00000009d70a38>

Extracted source (around line #1):

1: <%= form_for @community_topic, :html => { :class => 'form-horizontal' } do |f| %>
2:   <div class="control-group">
3:     <%= f.label :community_id, :class => 'control-label' %>
4:     <div class="controls">

rake routes shows I use ‘to_param’ for community’s id but I haven’t defined :community_id at all in my routes.rb. I wonder why rake routes shows this :community_id. Is that probably because I use ‘to_param’ for my community model?? That’s why it automatically detect that and replace :id to :community_id?

new_community_topic GET    /communities/:community_id/topic/new(.:format)      community_topics#new

routes.rb

resources :communities do
    resources :community_topics, :path => "topic", :as => :'topic'
end

views/communities/_form.html.erb

<%= form_for @community_topic, :html => { :class => 'form-horizontal' } do |f| %>

.......

  <div class="form-actions">
    <%= f.submit nil, :class => 'btn btn-primary' %>
    <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
                community_topic_path, :class => 'btn' %>
  </div>
<% end %>

Updated!!!

**rake routes | grep community_topic

   community_topic_index GET    /communities/:community_id/topic(.:format)          community_topics#index
                         POST   /communities/:community_id/topic(.:format)          community_topics#create
     new_community_topic GET    /communities/:community_id/topic/new(.:format)      community_topics#new
    edit_community_topic GET    /communities/:community_id/topic/:id/edit(.:format) community_topics#edit
         community_topic GET    /communities/:community_id/topic/:id(.:format)      community_topics#show
                         PUT    /communities/:community_id/topic/:id(.:format)      community_topics#update
                         DELETE /communities/:community_id/topic/:id(.:format)      community_topics#destroy
  • 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-16T07:37:52+00:00Added an answer on June 16, 2026 at 7:37 am

    As you are using nested routing then you have to pass and community into form_for:

    <%= form_for [@community, @community_topic], :html => { :class => 'form-horizontal' } do |f| %>
    

    upd: Or @community_topic.community in case you ain’t set @community.

    <%= form_for [@community_topic.community, @community_topic], :html => { :class => 'form-horizontal' } do |f| %>
    

    You can watch this episode of RailsCasts to fully understand nested resources. Episode use Rails 2 for examples but you should understand the conception.

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

Sidebar

Related Questions

I get an error that look like this: undefined method `post_image_will_change!' for #<Post:0xf4e9184> app/controllers/posts_controller.rb:43:in
I get an error that looks like this: NoMethodError (undefined method `image_will_change!' for #<Bar:0x24ddda0>):
I get this error when compiling a C# application. Looks like a trivial error,
I'm trying to access a hash by using an regular class method like this:
How would I get my error message to be conditional like this: <% if
Getting error when I tried like this: $ci =& get_instance(); $ci->db->select(CONCAT_WS(' ',users.name_first,users.name_last) AS user_name,CONCAT_WS('
sometimes i get an error like table is marked as corrupt and shld be
I have created Controller Attribute and would like to read SessionId but get error
I get a syntax error in Python 2.7.3 like so: [s += 'Orig' for
When running the packaged app like java -jar my-app-0.0.1-SNAPSHOT-jar-with-dependencies.jar, I get the following error:

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.