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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:00:49+00:00 2026-05-21T03:00:49+00:00

Trying to build a CMS for a blog using rails 3. In my routes.rb…

  • 0

Trying to build a CMS for a blog using rails 3.
In my routes.rb…

namespace :admin do  
  resources :posts  
  root :to => "home#index"  
end

In Admin::PostsController…

def update
  @post = Post.find(params[:id])

  respond_to do |format|
    if @post.update_attributes(params[:post])
      format.html { redirect_to(@post,
                  :notice => 'Post was successfully updated.')}
      format.xml  { head :ok }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @post.errors,
                    :status => :unprocessable_entity }
    end
  end
end

I had to change the first line of admin/_form.html.erb due to a previous ‘undefined method’ error that was driving me crazy. Was trying to point the browser to a nonexistent “post_path”.

<%= form_for(@post, :url => admin_posts_path(@post)) do |f| %>

All other methods for posts are working as expected. Upon form submission (update) – the rails server…

Started POST "/admin/posts.1"
ActionController::RoutingError (No route matches "/admin/posts.1"):

First, curious as to why it is using POST instead of PUT for the update.

Second, I can’t figure out why the URL is being interpreted as “/admin/posts.1” and how to fix it.

Has anyone else run into this problem? (and yes, I am following the rubyonrails.org guides closely to help me). Any help would be greatly appreciated.

EDIT:
Changed admin_posts_path(@post) to admin_post_path(@post) per theIV.

the rails server…
NoMethodError (undefined method 'post_url' for #<Admin::PostsController:0x00000102b26ff8>):
app/controllers/admin/posts_controller.rb:55:in 'block (2 levels) in update'
app/controllers/admin/posts_controller.rb:53:in 'update'

  • 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-21T03:00:49+00:00Added an answer on May 21, 2026 at 3:00 am

    I believe you should be hitting admin_post_path(@post), not admin_posts_path(@post).

    Look at the table that lists all of the helpers created for your routes on guides.rubyonrails.org.

    EDIT: Also, have you tried the array style of urls? It’s pretty convenient.

    <%= form_for([:admin, @post]) do |f| %>
    

    EDIT 2: My guess as to “undefined method post_url” is from your update action here:

    format.html { redirect_to(@post,
                  :notice => 'Post was successfully updated.')}
    

    It needs to be namespaced as well:

    format.html { redirect_to([:admin, @post],
                  :notice => 'Post was successfully updated.')}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build CMS using sharepoint foundation 2010 or drupal. We already
I'm trying to build a mini cms, whereby all urls go to the index
I'm trying to build a guestbook module within a Rails site using the Alchemy
I am trying to build a multi-level dropdrown menu, I'm using umbraco cms. What
I'm trying to build a CMS in Rails from scratch, and for showing the
I'm trying to build a small CMS using CodeIgniter, and I need to be
I am trying to build a CMS I can use to host multiple sites.
I am building a CMS using Ruby on Rails to teach myself the framework.
Trying to build a micro-CMS (of sorts), which needs to dish out content i.e.
I'm trying build a conditions array to be using in a prepared statement: Cars.find(:all,

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.