Installing ferret and acts_as_ferret - ruby-on-rails

I'm looking for a solid walkthrough or some direction on getting ferret set up on my rails server. Everyone on the internet makes it seem so easy, but I can't seem to get it all together.
What I've done succesfully:
gem install ferret
gem install acts_as_ferret
No sweat. No errors.
What doesn't work:
Video.find_by_content('test')
-----No Method Error
or
ActsAsFerret.find('test', 'my_index')
I get console to recognize the constant "ActsAsFerret"(only when I install the plugin from https://github.com/jkraemer/acts_as_ferret), but find() returns a No Method Error.
Update: Installing the plugin like this also prevents Mongrel from starting
I AM running in development mode, but configured ferret_server.yml to know what's up.
So does any one have any suggestions? And has anyone had more luck using acts_as_ferret as a gem or as a plugin? Googling gets me small scraps and parts of tutorials that don't seem to fit together, so I hereby vow to blog a solution to this when I figure it out.
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
rails (3.0.3)
P.S. I also ran
sudo apt-get install ferret
on someone's suggestion... still no luck. I'm not even sure if that'd be a reasonable solution for deploying.

have you added
gem 'ferret'
gem 'acts_as_ferret'
in your Gemfile and run
bundle install
?

you can use find_with_ferret method

Related

Could not find RubyGem rails - Rails Server error

I'm new to rails/ruby and I'm following a tutorial on how to create your first app using git and heroku!
After figuring out the sqlite3 debacle, the error I receive now comes every time I try to start a server.
rails server
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
This error is a pain in the arse, and I don't know how to get around it. There's several articles on here about this particular error, but no one mentions receiving this error while trying to launch the server.
Is there anybody out there that could walk me through the steps to take to remedy this.
Should I provide my gemfile
Should I also provide my database.yml file for reviewing
Logs, anything else I'm not mentioning that could be of help to figure out the source of this problem
Let me know, I'm trying to move forward ad don't want to be stuck at this particular error for days.
First you should install rvm: https://rvm.io/rvm/install then you should install ruby =< 1.9.3
rvm install 2.1
then you should install rails
rvm use 2.1 && gem install rails
then
cd PROJECT_PATH && rails server
everything should work fine

Can't boot WEBrick, the folder for Rails gem is empty

I'm following Michael Hartl's Ruby on Rails tutorial, and I got stuck at trying to start rails server on my Windows 7 machine.
I'm trying to do this by following instructions in Chapter 1.2.5., i.e. by typing
rails server
However, instead of booting WEBrick, this returns the instructions for usage of 'rails' command. I've been googling this for a while, and some of the answers seem to have implied that something is wrong with the rails gem.
Now, I've found the rails gem folder ("C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\rails-3.2.3"), and it's empty!
Also when I try
rails -v
it returns "Rails 3.2.16", although I've removed this version of the gem; if I try
gem list
it kept telling me that the version is 3.2.3.
This persisted until I deleted railties version 3.2.16, which resulted in
rails -v
returning 'Rails 3.2.3', but I still can't boot WEBrick.
Any help would be appreciated.
Did you run the installer?
At the time of this writing, I recommend using the Ruby 2.0.0-p353.
http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct
Save yourself some future gem headaches and install the DevKit too.
http://rubyinstaller.org/downloads/
It should create a folder at C:\Ruby200. Start a new command prompt for the new paths to take affect.
Once Ruby is install, gem install Rails. From your other post, I recommend gem install rails -v 3.2.16
Then execute rails new project_name, then cd project_name. Then run rake db:migrate to create the initial database. At this point, you should be able to run rails server and visit localhost:3000 in your browser.
OK, I've managed to solve my problem.
I've seen a few more people having the same issue, but none of the solutions that I've found helped me, so here's what did it for me, though I'm not 100% sure what exactly was that one thing that actually did it...
I've followed the advice #scarver2 gave in response to my other question, and uninstalled both Rails and Railties gems from my crispy fresh installation of Ruby 1.9.3. (I've installed it using RailsInstaller). Then I've installed Rails 3.2.16 gem by typing
gem install rails -v 3.2.16
and this also installed the corresponding Railties 3.2.16 gem without my intervention.
Then I followed steps from chapters 1.2.3. and 1.2.5. of the tutorial, but making sure that line referencing ruby version in my Gemfile actually corresponds to the version of Ruby that I have installed.
I typed
ruby -v
in the console, to make sure that I have version 1.9.3. indeed. Confirming this, I've edited the Gemfile in my app so it says
ruby '1.9.3'
instead of ruby '2.0.0' line that's used in Listing 1.5. of the tutorial.
After that I've simply went to my app folder, and typed
bundle update
bundle install
in the console, and this time it did not return any errors as it did in my previous attempts. After that, typing
rails server
did what it should have, and my WEBrick server booted, allowing me to access my app on localhost. Yay!
Now, what I think may have gone wrong the last time was either me screwing up the Gemfile, so the gem versions and their dependencies got messed up. I also assume that ineptly trying to fix this by installing and uninstalling different versions of various gems did not quite help. What may have helped was uninstalling Rails and Railties gems, and installing Rails gem again.

Changing gemets to be compatible with Passenger on Dreamhost

I had another post started:
Rack / Passenger fails on Dreamhost
but after some digging I am thinking my gems are incompatible. My Dreamhost Passenger uses Rails 3.0.3 and my dev system has 3.1.3. I have been playing around with rvm and gem but I can't figure out how to force rails and v3.0.3 dependancies.
Can anyone confirm that this is my issue and if so where do I start? I am sure I am missing something obvious but all my Googling has come up empty handed so far.
I am pretty new to Rails and the entire gem concept still hurts my brain and this is probably have the issue I have so far :^)
The simple solution is to edit the passenger entry in your gemfile to this:
gem 'passenger', '3.0.3'
and then run bundle update passenger on your dev machine.
I would really highly recommend you look into using rbenv or rvm to install and manage ruby and gems separate from the system gems that Dreamhost has installed though. I'm not sure if that's outside their terms, but you should be able to install locally for your user. This will help you avoid the same problem with other gems in the future.

Installing Refinery CMS on Windows

I cannot get Refinery cms to install on my crappy Vista machine. I have followed all instructions on http://github.com/resolve/refinerycms but the bundler doesn't work because there is not gemfile (I have copied the gemfile from github but it fails at rmagick gem) and have also tried the command line instructions but it fails at rake db:setup.
I have tried installing all required gems myself but this makes no difference.
Can anyone give me a quick step by step on how to get it running? I have now completely removed ruby so can start afresh. I have the installers from rubyinstaller.org and have tried with both 1.8.7 and 1.9. I have mysql 5.1 installed.
Much appreciated!
If this is still a problem, try using the latest version of refinerycms (0.9.7.7) as there have been a lot of improvements to the installation process since then.
(also, please retag this question with refinerycms)
You have to install RMagick yourself as it can`t be done by the bundler, have you tried this?
http://rmagick.rubyforge.org/install-faq.html#win

Paperclip as a gem and Phusion Passenger (mod_rails) - can't find Paperclip

I'm using paperclip by thoughtbot for attachments to models and everything works fine on my development machine running mac os x and mongrel. However when I deploy may app to a debian machine running apache/mod_rails (2.2.5) I can't get it started. I get 'undefined method has_attached_file' (or 'uninitialized constant Paperclip' using an initializer). I'm sure there is an easy solution but I appear to be blind... Any hints? Thanks!
I would suggest just 'vendoring' your gems. Just require the gems you use in your environment.rb file using config.gem syntax (you can search online for more specific instructions) and then once those entries are in there, just run 'rake gems:unpack' and the gems you have installed that are required for the app (via the config.gem entries) will be put in vendor/gems.
This way your app will always know where to find your gems...
Make sure you have this gem properly installed on target machine. If you used REE when installing Passenger then you need to install gems with gem-e instead of gem. In short:
sudo gem-e install paperclip
Blind was right! I finally solved the issue by specifying the paperclip gem thru the proper config.gem entry in environment.rb. I maintain two different environment.rb files, one for development, the other for the production server and I forgot to add the paperclip config.gem line to the latter... Too bad, sorry for bothering you and thanks heaps for answering! Cheers!

Resources