Every time I submit the form I get this error: undefined method `each' for nil:NilClass. If everything is correct I can submit the form without any problems, but when there is one thing missing it gives me that error. The error sends me to this line:
views/users/new.html.haml
- @subscriptions.each do |fbs|
= fb.radio_button :subscription_id, fbs.id, class: 'radiobtn', required: true
controllers/users_controller.rb
def new
@user = Users::Business.new
@subscriptions = Businesses::Subscription.all
end
def create
@user = Users::Business.new(user_params)
if @user.save
sign_in(@user)
else
render :new
end
end
createaction, how does it look like? I suspect that you callrender "new"and don't set@subscriptions.newtemplate from withincreatebut you don't set@subscriptionsas required by the template.