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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:28:46+00:00 2026-05-31T09:28:46+00:00

In Rails 2.3.8 I have a credit cards controller that needs a customer_id. I

  • 0

In Rails 2.3.8 I have a credit cards controller that needs a customer_id. I use a before_filter and a method to grab the customer id. I use paths like new_admin_credit_card_path(:customer_id => @customer.id) to get to pages handled by the credit card controller. I am having trouble on a form submit to create or edit credit cards. The customer id either doesn’t get passed or gets passed but the action does not respond properly. Here’s what I’m trying in my form_for:

<% form_for :credit_card, 
:url => admin_credit_cards_path(:customer_id => @customer.id) do |f| %>

  ...BLAH BLAH CODE BLAH...

  <%= f.submit %>

<% end %>

Here’s the error I get:

Routing Error
admin_credit_card_url failed to generate from {:customer_id=>37165, :controller=>”admin/credit_cards”, :action=>”show”}, expected: {:controller=>”admin/credit_cards”, :action=>”show”}, diff: {:customer_id=>37165}

I’ve also tried this:

<% form_for (:credit_card, @credit_card, :url => { :controller => "admin/credit_cards", 
 :action => "update" } ) do |f| %>

And I get

Unknown action

No action responded to 37762.

It think the customer id is the action.

Here’s my create and update methods in the controller:

def create
  @credit_card = scope.new(params[:credit_card])
  set_modified @credit_card

respond_to do |format|
  if @credit_card.save
    flash[:notice] = 'CreditCard was successfully created.'
    format.html { redirect_to admin_credit_card_path(:customer_id => @customer.id) }
    format.xml  { head :created, :location => admin_credit_card_url(:customer_id =>     
@customer.id ) }
  else
    format.html { render :action => "new" }
    format.xml  { render :xml => @credit_card.errors.to_xml }
    end
  end
end


def update
@credit_card = scope.find(params[:id])
set_modified @credit_card

respond_to do |format|
  if @credit_card.save
    flash[:notice] = 'CreditCard was successfully updated.'
    format.html { redirect_to admin_credit_card_path(:customer_id => @customer.id ) }
    format.xml  { head :ok }
  else
    format.html { render :action => "edit" }
    format.xml  { render :xml => @credit_card.errors.to_xml }
    end
  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-31T09:28:47+00:00Added an answer on May 31, 2026 at 9:28 am

    You should pass the customer_id as a hidden field in the form, rather than as part of the path helper.

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

Sidebar

Related Questions

I have Rails 3.1.2 app with a hierarchical relationship that looks like this: Categories
I'm setting up a rails site that will accept credit cards with ActiveMerchant and
Does rails have a break statement? I'm writing a controller that has some pretty
I know that before_filter is only for controllers in Rails, but I would like
I have three links in my Rails 3 app that load information in the
Does Rails have an equivalent of the Server.MapPath method from ASP.NET? I've tried looking
I have a query that needs to return results that are NOT matched in
I have a rails application that I am implementing the Twilio SMS API on,
Question 1) I would like to know whether ruby on rails have gems with
I have an issue with ActiveMerchant credit card validation in my rails 2.3.2 application.(ActiveMerchant

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.