-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First argument in form cannot contain nil or be empty #2451
Comments
Ah nevermind, it turns out this was due to not having code in the custom controller new method. This worked pre rails 4, but there has since been code added which catches this and shows an error. |
I am having the same issue. Just wondering how you fixed this. thanks |
Basically the error is due to a change in Rails which means you can no longer pass blank variables into a form_for. You need to therefore make sure you add the resource code as below, to your custom controller. self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource)) |
Or i've just realised my stupidity, instead of the above you can simply add "super" inside your new method, which would then inherit from the devise controller new method. def new
super
end |
Not sure why but the only diff from the old devise controller and the new one was that first line |
In my custom controller, I have def new I have following code in application helper Devise helper method for resourcedef resource_name def resource def devise_mapping But none of this are working. Still facing same problem. |
I didn't have any of that code in the application helper as, although I am not 100%, that should probably be included anyway.. if you have a customer controller you should just need; def new
super
end which worked for me. |
It doesn't work for me. But when I include ApplicationHelper module in customer controller then it work. I have define devise helper method for resource in ApplicationHelper. So, I include it in my customer controller. For example. ##application_helper.rb module ApplicationHelper Devise helper method for resourcedef resource_name def resource def devise_mapping ................... ##password_controller.rb |
Using Rails 4, I'm having this same issue without a custom controller... I only have custom views (which are just the standard ones generated through devise). |
@amritdeep I was using the default views generated by |
@thenadz great job dude |
When I start up my application and it takes me to the sign in page, I am getting the error:
which is corresponding to this line:
I tried searching and couldn't seem to find any issues regarding this. Any ideas on a fix?
I am running rails 4 with devise 3
The text was updated successfully, but these errors were encountered: