Working with Rails 3 and Authlogic. I am following the steps on this tutorial: http://bit.ly/l8YOGg.
Signup/login/logout are all working fine and now I am adding email activation. I have used all the code exactly as listed on the tutorial, and when I attempt to sign in as a new user I get the following error:
NoMethodError in UsersController#create
undefined method `activate_account_url' for #<Notifier:0x00000103c4c9b8>
app/mailers/notifier.rb:6:in `activation_instructions'
app/models/user.rb:21:in `send_activation_instructions!'
app/controllers/users_controller.rb:17:in `create'
Can't find anything in the Authlogic documentation or elsewhere that helps. What am I doing wrong?
activate_account_url should be a named route. Did you define your routes correctly?
To find the correct route name, check rake routes, in particular rake routes | grep activate. Then put the correct route name into notifier.rb on line 6.
Related
My devise route helpers methods are not recognized in my Ruby functional tests.
For instance, my application's layout contains a call to edit_admin_registration_path (since my device model is Admin) and I get the following error:
ActionView::Template::Error: undefined local variable or method `edit_admin_registration_path' for #<#<Class:0x007ff332374038>:0x007ff330d54988>
when running:
rake test:functionals TEST=test/functional/my_controller_test.rb
I think I get this problem since upgrading to Rails 3.2.15. Any idea why? (devise version is 3.2.2)
Make sure that you have this route helper by:
rake routes
Seems like similar discusion Rails Can't find route in Functional Test
So, I have a standard rails 3 app with authlogic. If I'm not in the browser (in the console or in the test environment), I can't create user models.
For example:
I have this code either in a rspec test or in my console:
user = User.create(...user attributes...)
And I get this error:
NoMethodError: undefined method `cookies' for main:Object
I've looked all over the internet and can't figure this out. Any help would be greatly appreciated.
EDIT:
So, I looked around some more and found in the documentation to do this:
include Authlogic::TestCase
but then I get this error:
uninitialized constant Authlogic::TestCase
I had this same exact problem. Where in your application did you put the following line:
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
I ran into this error when I placed the line in either the environment.rb file or within a file within my initializer folder.
I eliminated the problem when I placed the line in my ApplicationController instead.
I'm trying to implement Swiftype on Rails 3.2.5. However, when adding a category, and running rake jobs:work, I get the following error message:
CreateSwiftypeDocumentJob failed with NoMethodError: undefined method
`post_url' for #
In the CreateSwiftypeDocumentJob model I have :
post = ProposalCategory.find(proposal_category_id)
url = Rails.application.routes.url_helpers.post_url(post)
If somebody could please help with this, that'd be much appreciated.
post_url should only be used if you actually have a route for the Post resource.
What is in your routes.rb file? Presumably something like:
resources :proposal_categories
In that case, you would need to use a route like proposal_category_url.
I have added new fields to Devise and did rake db:migrate, etc, and it seems to work fine on local host, however on Heroku I get the following error in my logs claiming there is an unidentified method:
https://gist.github.com/1179667
Any help or advice would be appreciated.
Thanks,
So looks like my problem was a combination of a spelling mistake in my user.rb and having zipcode there also which wasn't in the form.
Im trying to follow this tutorial.
Its about adding email confirmation after registration... The thing is when I submit the form I get this error
NoMethodError in UsersController#create
undefined method
`deliver_verification_instructions!'
for #
I looked at the code and indeed there is no such a method on my user model... Im very new at rails...Is the tutorial wrong??
Yes, tutorial has missed that method in User model. It should be something like this instead of deliver_password_reset_instructions:
def deliver_verification_instructions!
reset_perishable_token!
Notifier.deliver_verification_instructions(self)
end
I haven't checked that tutorial if rest is OK, but that was wrong for sure