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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:17:28+00:00 2026-06-05T15:17:28+00:00

Using devise 2.1.0 I am trying to send the new registration page a PricingPlan

  • 0

Using devise 2.1.0
I am trying to send the new registration page a PricingPlan model.
So in my routes I have:

devise_scope :user do
    delete "/logout" => "devise/sessions#destroy"
    get "/login" => "devise/sessions#new"
    get "/signup/:plan" => "devise/registrations#new"
  end

And I override the devise registration controller. With this in my routes.rb to make it work:

devise_for :users, :controllers => {:registrations => "registrations"}

In my actual Registration controller which overrides Devise’s controller I have:

class RegistrationsController < Devise::RegistrationsController
  view_paths = "app/views/devise"
  def new
    super
    @plan = PricingPlan.find_by_name(params[:plan])
  end

So that the default views still go to devise….
In my new view for the registration controller I call this:

<h3>You've chosen the <%= @plan.name %> plan.</h3>

And I get this error:

undefined method `name' for nil:NilClass

Also… in my PricingPlan model:

class PricingPlan < ActiveRecord::Base
  has_many :users

And in my User model:

class User < ActiveRecord::Base
  belongs_to :pricing_plan

I’m rather new at rails.

  • 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-05T15:17:29+00:00Added an answer on June 5, 2026 at 3:17 pm

    When I did a raise in my registration controller, I realize that when I was hitting /signup/:plan it wasn’t hitting the registrations controller that I had overode from devises registration controller.
    I figure out the reason:
    Because I had made my own controller, the scope is no longer devises scope any more…

    So this was WRONG:

    get "/signup/:plan" => "devise/registrations#new"
    

    This however is CORRECT:

    get "/signup/:plan" => "registrations#new"
    

    So that part of my routes looks like this:

      devise_scope :user do
        delete "/logout" => "devise/sessions#destroy"
        get "/login" => "devise/sessions#new"
        get "/signup/:plan" => "registrations#new"
      end
    

    Everything else in the code stayed the same.
    Thanks for @gabrielhilal for making me trace out the controller.

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

Sidebar

Related Questions

So I am using Devise for user authentication in my rails app. I have
We have a web app running on Rails, using Devise and OmniAuth for user
I am trying to allow the user to reset their password using Devise's recoverable
Im trying to override devise in order to send mail to activate a user.
im using devise and im trying to send a welcome email after someone signs
I am using the Devise gem and in the sign in page I expect
I am trying to send mail using MFMailComposeViewController. Everything works, except that mails do
Hello I am trying to send a push message to my device using Java.
I'm trying to send devise confirmation emails from my Rails 3.2 app. However when
I'm trying to send push notifications to my device using javapns library in liferay

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.