I've installed the restful_authentication plugin. I'm Using rails 2.2.2. However, I can't seem to get past a certain error:
"undefined method acts_as_state_machine"
It doesn't matter if I call db:migrate or script/server, everything results in this same error.
Any ideas?
If you use --stateful or --aasm when you run the generator, it enables acts_as_state_machine support. If that is behavior you want, try installing aasm from the above github link and see if that resolves your issue.
Related
I'm working on a project where we are migrating from an old ruby web api (not rails) that was pulling in activeSupport and activeRecord 4.1.8 and using resque 1.25.2 for jobs to a new rails 4.2.4 project using resque 1.25.2 for job processing as well. Everything has been going pretty smoothly until I started a resque work to process jobs and I got:
NoMethodError: undefined method 'synchronize' for ActiveRecord::AttributeMethods::GeneratedAttributeMethods
This error is only thrown when User.find_by_id or User.new is called within the context of a worker process. This same error is thrown when calling several other models as well but not all of them. Company.new, for example, doesn't throw the error and if I rename the User model to say Companya the error goes away... Running ruby 2.2.3 on the rails app.
Any help would be greatly appreciated.
I guess I've encountered the issue once...
The exception would be raised when Rails failed to find the method that was generated dynamically. So the case I can imagine is that Rails (ActiveRecord) did not define the methods dynamically.
The matters which should be checked are...
restarting resque and KVS.
models' class names, parent classes (should be ActiveRecord::Base) and migration files if that follow Rails naming conventions correctly. See here: http://guides.rubyonrails.org/active_record_basics.html#naming-conventions
reset and migrate again in all environments with the argument like $ bin/rake db:migrate:reset RAILS_ENV=production
stopping the Spring once by $ bin/spring stop. (It restarts automatically when the next bin command is called.)
hmm...Can you use those methods in rails console?
Hope it would help...!
`synchronize' error happens when the related gem is not up to date. I belive if you update your installed gems then the issue would be resolved.
I was pairing with a coworker, and after writing a feature using the desk.com api, everything was working fine. It was deployed to a staging server, where it too worked fine. However, when I run the code on my local dev machine, when I try to query the api (for example, request all the users on our account), I get a runtime error.
I'm using the desk ruby gem: https://github.com/chriswarren/desk
Here is a session in the rails console:
[1] pry(main)> Desk.users
RuntimeError: missing dependency for FaradayMiddleware::Deashify: undefined method `type' for class `Hashie::Mash'
from /home/rooney/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/middleware.rb:20:in `new'
This is the error I get. I haven't been able to find any info on this error. If anyone needs more info just ask.
Methods "type" and "id" are removed in Hashie version >= 3.4.2
You can fix by rolling back to Hashie v3.4.1
Are you using bundle exec? It's possible that you're using the wrong version of a gem. Try uninstalling versions of the gem other than the one you need.
i have installed nifty_generators successfully. Though, when i run the following command:
rails generate nifty_authentication
i get the error:
Could not find generator nifty_authentication.
I have included gem 'nifty_generators' in my gem file. What is the error?
Couple of things after looking on its github.
First, I believe the gem is call nifty-generators not nifty_generators, which may be causing you some other problems as well.
Second, per the instructions , you should be calling it via rails g nifty:authentication.
I am trying to build Noosfero (http://noosfero.org/), a project done in Ruby, but I am pretty new in Ruby and Linux (my current environment).
I am following the instructions in their tutorial (http://gitorious.org/noosfero/noosfero/blobs/master/INSTALL and http://gitorious.org/noosfero/noosfero/blobs/master/HACKING).
I was supposed to run an apt-get install with many packages, everything worked except for libgettext-ruby-data, to which I get a message that "E: Package libgettext-ruby-data has no installation candidate".
I then download the source and try to run "rake db:schema:load", which I get the following error:
"rake aborted!
uninitialized constant Dependencies
/home/user/noosfero/Rakefile:10"
My rake file is the following:
require(File.join(File.dirname(FILE), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails' #this is the line that the dependency can't be found
I searched around and found this question here: Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError) , but changing the config files didn't help and I could wasn't able to downgrade my RubyGems because I do not know how to do that (gem -update returns a message that I have to do that using apt-get, but I can't find out in which package the gem program is).
The first time I run Rake, I get a message saying:
"I: Installing Debian-installed Rails from /usr/share/rails into vendor/rails.
I: Please note that the recommended Rails version is 2.1.0, and that other versions might not work"
But I don't know how to downgrade my Rails version.
I've got many paths to follow, so I've got many questions, I hope you can help me:
1- Does anyone knows how to fix it directly?
2- How can I downgrade Gems?
3- How can I downgrade Rails?
4- Where can I download gems and how can I install it? (The documentation provides a link, but this link is VERY strange: http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext ).
Any help is very appreciated.
Thanks,
Oscar
Edit: can this error be a problem in the project I downloaded and not in my environment? After some research I am starting to think it is, can it be?
It would help if you share your rake version, by the way.
In the meantime, take a look at this:
https://github.com/jimweirich/rake/issues/33
(Only valid for rake 0.9.0, though).
This was a version conflict I had with the project I was trying to build, not it is solved :)
First of all, I'm a Noosfero developer and I need to admit that the process of preparing the environment to run Noosfero right now is pretty nasty (unless you only want to run it in the production mode since we've got a debian package). But this problem is close to an end since we're a building a vagrant box (for more info see http://vagrantup.com/) to noosfero. Things are going to be much better. But regardless all this nastiness and not having the box yet, Noosfero was supposed to run if you followed all the steps in the INSTALL instructions. Let me try to help you.
Are you using Rails 2.1.0? The best way to do so is to uninstall rails from your system (if you installed through apt-get) and install through rubygems:
gem install rails -v=2.1.0
To avoid problems ensure that there isn't any other version of rails installed through rubygems (gem list).
If you still having problems to run the schema load, run it with --trace and post it here.
If you have other problems you can try contacting us through noosfero-dev#listas.softwarelivre.org or the irc #noosfero at FreeNode.
So today I've been working with RoR for the first time using the book 'Rails for PHP developers'. I'm following the tutorial in there.
I created a project, with a model Subscriber and a controller Subscribers, which has a method create. Then I ran ruby script/server to launch Mongrel.
Now, the book says that if I go to http://localhost:3000/subscribers/create I should get an error because there's no template associated (yet) for this action. The book shows this error message:
Template missing
Missing template subscribers/create.html.erb in view path /Users/derek/work/newsletter/app/views
A nice descriptive error message, really helpful. But the error I get is:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
That error is not helpful at all. I suspect it has to do with the fact that the book uses WEBrick, and I use Mongrel. But I assume it should be possible to get more descriptive errors, right? It seems quite painful to develop with errors like this.
It looks like some of your Rails install is semi borked. You might be missing the mysql gem or might not have the mysql ActiveRecord adaptor configured correctly.
Use gem list to see the gems you have installed
$ sudo gem list
you can use the gem install command to install or update gems
$ sudo gem install rails mysql
You usually want to install gems with sudo (as root) so all users can use them ( like apache or www-data)
Im sorry your first try at Rails hasn't gone smoothly, trust me it is an extremely powerful framework. Strick with it!
You probably forgot to setup the database. You can check log/development.log for further details.
you only get the first message if you are running in development mode.