undefined method `error_messages_for' for #<#<Class:0x3981390>:0x - ruby-on-rails

problem like this:
undefined method `error_messages_for' for #<#:0x3a4f700>
My English is very rubbish, who can help me solve the problem? thanks

Error messages for was removed in rails 3. It was extracted to a plugin,
don't remember exactly what the plugin was called but it's in the rails
GitHub repo. Rails has changed massively since 1.0.
Check this Error messages for replacement.

Related

undefined method 'engines' for Rails::Engine::Railties:Class

I have been setting up ruby on rails on my mac - I'm learning (I guess we all are) - I run rails and go to the site where the app is and see the following error.
undefined method 'engines' for Rails::Engine::Railties:Class
The app was running fine until I bundle installed the dependant gems (I think I may have updated them).
How do I read this error so I know what actually is wrong.
If I have to define the method, how do I do that - what with and where?
Thanks in advance,
Dan

undefined variable or method 'params' for ActiveAdmin

Just installed Rails 3.1 rc5 and ActiveAdmin from rails-3-1 branch.
Installation went good, and I see the login form. However when I login with provided username/password I'm getting the following error:
ActionView::Template::Error (undefined local variable or method `params'
for #<ActiveAdmin::Views::Pages::Dashboard:0x00000001a59b00>):
1: render view_factory.dashboard_page
Any tips on this one?
Thanks in advance!
The rails-3-1 branch has been merged in to master includes a bunch more bug fixes. Can you please use master instead of rails-3-1 and see if that works?
I will work on adding Rails 3.1.rc5 to the test suite to ensure that everything is working as expected.
EDIT: I just pushed a fix to github (7cd0bcc2e953969541c22c2fe5842995f4fbb80d) that fixes this "params" issue. Should work using Github master branch now.

Ruby on Rails Plugin: acts_as_taggable_on_steroids. Keep getting "method_missing" undefined local variable or method 'acts_as_taggble_on'

I am trying to implement a tagging system for my rails app. I employed the popular plugin acts_as_taggable_on_steroids, and followed the instruction on how to install it. I then included acts_as_taggable in the model that I would like to have tags on, but then when I try to start the server I keep getting the error method_missing': undefined local variable or methodacts_as_taggable' for # (NameError)
I look on google and the author suggested to try acts_as_taggable_on, but still this did not fix the problem. I am struggling on this problem for hours already, but still don't know where is the problem. Could anyone please shed some light?
Thank you very much for all the help!!
Did you try to require the lib ruby of act as taggable on steroids at the beginning of your file?
Something like:
require 'acts_as_taggable'
maybe?

Rails 2.3.9, adding ActiveScaffold, getting in `alias_method': undefined method `number_of_pages' for class `Paginator'

I have AS (as a plugin) working in another app just fine (I dont remember this
issue...) - its also using Rails 2.3.9, on same dev box.
Now trying to add it to a new app and getting this error when running
the webrick, script/server:
/Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.9/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method':
undefined method `number_of_pages' for class `Paginator' (NameError)
from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/
activesupport-2.3.9/lib/active_support/core_ext/module/aliasing.rb:
33:in `alias_method_chain'
from /Users/kimptoc/Documents/ruby/borisbikestats/vendor/plugins/
active_scaffold/lib/extensions/paginator_extensions.rb:9
I couldn't find any previous references to this error.
Embarassingly I dont know which version of AS I am using successfully... it says 1.2RC1 in the CHANGELOG file, but I seem to remember trying a few of the forks...(is there somewhere I can see which fork is in use...). I have tried using the the 'main' activescaffold in the new project, but it fails as above, but so does using the same plugin that is in the working project :(
Thanks in advance for any pointers as to what I am doing wrong.
Thanks,
Chris
PS Just realised that new Rails was using Rails 3 and old/working one was 2.3.9. It seems you need to use an alternate branch of AS for Rails 3, like this : https://github.com/vhochstein/active_scaffold/wiki
This is just a guess, but built in pagination was removed in Rails 2 as I recall, and you needed to install the classic_pagination plugin to get that functionality back.
I only used ActiveScaffold once, but the error there says paginator_extensions.rb ... it's probably monkey patching the old Rails paginator? Therefore the class exists but the number_of_pages method doesn't.

Starting out with vote_fu

Trying my luck with the vote_fu rails plugin. The functionality looks like exactly what I need for a project of mine, but I have hit a roadblock. I have followed the github readme to the letter, installing it as a plugin.
I have put acts_as_voteable on my "Event" model and acts_as_voter on my User model.
In the console, when I try:
>> event.votes
or
>> user.votes
it successfully returns an empty array.
but when I try to do the following:
user.vote_for(event)
I get
"NoMethodError: undefined method `user_id' for #<Vote:0x7f5ed4355540>"
Any ideas? I'm probably just missing something obvious, but maybe something is missing from the plugin's readme.
Thanks.
[Update]
I created a blank application and the plugin works fine, so I think that this problem might be being caused by the use of the "desert" plugin, as my User class is split over two files. If I find the answer, I'll post it so that in the off chance someone else runs into this it may be some help.
Cheers.
Ok, I haven't found a definitive reason why this problem occurred, but I do have strong suspicions that it is due to the use of the "desert" plugin, as my User class is split over two files (the project is using the CommunityEngine plugin as a base),
Anyhow, I found a work around (something I should have tried before posting here). Instead of installing vote_fu as a plugin, I installed it as a gem. And now vote_fu seems to be humming along nicely.
So let that be a lesson to you all!
:-P

Resources