Note that there are some explanatory texts on larger screens.

plurals
  1. POrails 3 - path error when using form_for on a resource
    primarykey
    data
    text
    <p>In my rails project I'm getting the following error when I view <code>/subscription/new</code>:</p> <pre><code>NoMethodError in Subscriptions#new Showing /redacted/app/views/subscriptions/new.html.erb where line #4 raised: undefined method `subscriptions_path' for #&lt;#&lt;Class:0x007fd02c8bbb28&gt;:0x007fd0308f7a48&gt; Extracted source (around line #4): 1: &lt;div class="grid_6"&gt; 2: &lt;h1&gt;New Subscription&lt;/h1&gt; 3: &lt;p&gt; 4: &lt;%= form_for @subscription, :html =&gt; { class: 'form_dark' } do |f| %&gt; 5: &lt;% if @subscription.errors.any? %&gt; 6: &lt;div class="error_messages"&gt; 7: &lt;h1&gt;&lt;%= pluralize(@subscription.errors.count, "error") %&gt; prohibited this subscription from being saved:&lt;/h1&gt; </code></pre> <p>My routes file contains <code>resource :subscription</code> for this.</p> <p>Additional code information:</p> <p>User model:</p> <pre><code>class User &lt; ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessible :email, :password, :password_confirmation, :remember_me has_one :subscription end </code></pre> <p>Subscription model:</p> <pre><code>class Subscription &lt; ActiveRecord::Base attr_accessible :status, :stripe_token, :user_id, :last_charge, :stripe_card_token belongs_to :user has_many :payments, :dependent =&gt; :destroy belongs_to :plan attr_accessor :stripe_card_token end </code></pre> <p>My SubscriptionsController new method:</p> <pre><code>def new @subscription = User.find(current_user.id).build_subscription end </code></pre> <p>Any help is appreciated, thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload