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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:28:10+00:00 2026-05-27T23:28:10+00:00

It seems simple, in my model I have: class CustomerAccount < ActiveRecord::Base acts_as_url :name

  • 0

It seems simple, in my model I have:

class CustomerAccount < ActiveRecord::Base

  acts_as_url :name

  def to_param
    url # or whatever you set :url_attribute to
  end

end

And in my controller, I have:

class CustomerAccountsController < ApplicationController
  def show # dashboard for account, set as current account
    @account = CustomerAccount.find_by_url params[:id]
    no_permission_redirect if !@account.has_valid_user?(current_user)
    set_current_account(@account)

    @latest_contacts = Contact.latest_contacts(current_account)
  end
end

What’s currently in the routes.rb is:

  resources :customer_accounts, :path => :customer_accounts.url do
    member do
      get 'disabled'
      post 'update_billing'
    end
  end

That gives me the following error when I try to generate data via rake db:seed, or at least I assume the entry in routes is what’s doing it.

undefined method `url' for :customer_accounts:Symbol

So what do I need to do to get the route set up? What I’d like is http://0.0.0.0/customeraccountname to map to the view for the customer account page.

UPDATE:

Here is the code that ended up working in routes.rb, which I discovered after looking at the examples in the answer below:

  resources :customer_accounts, :path => '/:id' do
    root :action => "show"
    member do
      get 'disabled'
      post 'update_billing'
    end
  end
  • 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-27T23:28:11+00:00Added an answer on May 27, 2026 at 11:28 pm

    If you want to set it up so you have a route like you show, do this:

    get '/:id', :to => "customer_accounts#show"
    

    If you want the disabled and update_billing actions underneath this:

    get '/:id/disabled', :to => "customer_accounts#disabled"
    post '/:id/update_billing', :to => "customer_accounts#update_billing"
    

    Alternatively (and much neater):

    scope '/:id' do
      controller "customer_accounts" do
        root :action => "show"
        get 'disabled'
        get 'update_billing'
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple model: class Project < ActiveRecord::Base belongs_to :user class User <
I have a simple model class Task < ActiveRecord::Base validates :deadline, :if => :deadline_in_future?
I have a simple Poco-Model using abstract classes, and it seems not to work
I need some help with this one.... I have this simple model: public class
I have a simple model setup in my Ruby on Rails app. (User {name,
I've quite a simple query regarding models. I have a model - class User
I have a simple test application: Model: public class Counter { public int Count
I have a model: class Zone(models.Model): name = models.CharField(max_length=128) users = models.ManyToManyField(User, related_name='zones', null=True,
today a weird problem occurred to me: I have a model class in Django
Item is a simple model class. ItemComponent is a view for an Item which

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.