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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:10:41+00:00 2026-06-05T07:10:41+00:00

In my rails project I’m getting the following error when I view /subscription/new :

  • 0

In my rails project I’m getting the following error when I view /subscription/new:

NoMethodError in Subscriptions#new

Showing /redacted/app/views/subscriptions/new.html.erb where line #4 raised:

undefined method `subscriptions_path' for #<#<Class:0x007fd02c8bbb28>:0x007fd0308f7a48>

Extracted source (around line #4):

1: <div class="grid_6">
2:   <h1>New Subscription</h1>
3:   <p>
4:     <%= form_for @subscription, :html => { class: 'form_dark' } do |f| %>
5:       <% if @subscription.errors.any? %>
6:         <div class="error_messages">
7:           <h1><%= pluralize(@subscription.errors.count, "error") %> prohibited this subscription from being saved:</h1>

My routes file contains resource :subscription for this.

Additional code information:

User model:

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

  attr_accessible :email, :password, :password_confirmation, :remember_me

  has_one :subscription
end

Subscription model:

class Subscription < ActiveRecord::Base
  attr_accessible :status, :stripe_token, :user_id, :last_charge, :stripe_card_token
  belongs_to :user
  has_many :payments, :dependent => :destroy
  belongs_to :plan
  attr_accessor :stripe_card_token
end

My SubscriptionsController new method:

def new
    @subscription = User.find(current_user.id).build_subscription 
end

Any help is appreciated, thanks!

  • 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-05T07:10:43+00:00Added an answer on June 5, 2026 at 7:10 am

    I believe that when you pass form_for an object like @subscription (which has class Subscription), it expects the url subscriptions_path by default. But since you have declared subscription as a singlular resource, the url subscription_path is defined instead. You should explicitly specify this route

    <%= form_for @subscription, url: subscription_path, :html => { class: 'form_dark' } do |f| %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails project and keep getting the following error when trying to
In my Rails project I have the following code: auto_link( h( wrap_long_string(post.text,50) )).gsub(/\n/,<br />)
Starting a new rails project and we have a well-thought-out color palette, and want
In my rails project I have a presenter method that has a helper view
This is not a ruby/rails project deploy. I have the following situation and I
I have a Rails project that is basically a simple web app for a
I created a new Rails project, I used scaffold and then tried to: rake
I have a rails project where the the view displays a list of items.
In my new Rails project,I want to provide my user two kinds of category
Ruby on rails project: I upgraded my files on server (app, config), runned bundle

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.