Reputation: 649
When I try to run my signup form for a web app that I'm building in Rails, I get the following error:
uninitialized constant User::PillHQ
which references two methods in my app code, one in my user model and one in my user controller.
The method in question in the user model is
def save_with_payment
if valid?
customer = Stripe::Customer.create(description: email, plan: PillHQ, card: stripe_card_token)
self.stripe_customer_token = customer.id
save!
end
and the method in question in the user controller is
def create
@user = User.new(params[:user])
if @user.save_with_payment
sign_in @user
flash[:success] = "Welcome to the Sample App!"
redirect_to edit_user_path(current_user)
UserMailer.welcome_email(@user).deliver
else
render 'new'
end
end
I'm not sure how to remove the error, so any help you can give would be awesome!
Upvotes: 0
Views: 687
Reputation: 10769
The word PillHQ
on the line below is not valid against "Naming Conventions", assuming it is a variable...
customer = Stripe::Customer.create(description: email, plan: PillHQ, card: stripe_card_token)
Local Variables
Lowercase letter followed by other characters, naming convention states that it is better to use underscores rather than camelBack for multiple word names, e.g. mileage, variable_xyz
More information can be found here.
Upvotes: 1