acts_as_ferret multi model search not working in rails app - ruby-on-rails

I am trying to solve a strange issue with ferret/acts_as_ferret
Of course I have googled and posted the question:
http://www.ruby-forum.com/topic/188570
Basically aaf works on single models with no issue. It also works on single models using the config/aaf.rb file I have setup. It even works when I do a multi-model search in the console, but within the rails app itself I get:
undefined method `ferret_rank=' for <object that has a match>
If anyone has had the same experience/problem and can shed any light I would appreciate it.
PS: I followed the following tutorial to get where I am now.
http://opensoul.org/2008/4/29/using-shared-indexes-with-acts_as_ferret

Do you have the plugin installed or just the gem? You might want to install the plugin.
I would also try rebuilding the index.
For my purposes, I switched to Solr and life is a lot easier. Sphinx is missing a lot of stuff that I need.

Related

Bourbon/Neat Rails Error: List index is 2 but list is only 1 item long for nth

Disclosure: This is my first Rails app
I'm getting an error within Neat when trying to use the new-breakpoint mixin. I have cut-up my application templates and am now spinning up and integrating them in to a new Rails instance. Bourbon and Neat work fantastically in my templates, but from within Rails, I'm getting...
List index is 2 but list is only 1 item long fornth'`
Has anyone come across this issue before?
More info can be found here github.
The only thing I can think of is that there is an error in the gem? That doesn't make sense though as everyone would be experiencing the same issue. However, the only difference between using Neat in Rails comes down to using a gem and doing #import "neat" instead of #import "neat/neat" (from a folder)
If anyone can shed some light on whatever I can do to fix this, that would be fantastic.

ActiveRecord association not found - but only on second load

I recently upgraded from Rails 2.0.2 to 2.3.8 and have been ironing out the kinks. This one is baffling me.
I have a page that runs fine in production, but in development mode it runs fine on first load, then on reload it crashes with:
ActiveRecord::ConfigurationError - Association named 'average_prices' was not found; perhaps you misspelled it?
It's a nested eager-load call:
list_user.bookmarks.visible_to_user(logged_in_user_id).find(:all, :conditions=>filter, :include=>[:user, {:gift=>:average_prices}, :tags, :product_image])
My feeling is that the error isn't strictly related to the real problem... aside from the fact that the code runs correctly (in production) I have also observed other errors sporadically in my app to the effect of:
A copy of [one of my helper classes] has been removed from the module tree but is still active!
Googling for this has resulted in much discussion of marking classes as "unloaded" and using "require_dependency" instead of "require"... but I've tried a number of things without any luck.
Does anyone have any clues here? Something seems funky to me with regard to loading/reloading classes.
NOTE: I think what I'm seeing is likely the same as this, but the fix posted here didn't work for me.
I've had similar problems when I was using certain plugins. Could this come from a plugin?

Ruby on Rails fails to connect to Mongodb locally using MongoMapper

I'm very new to rails and have been trying to experiment with using Mongodb on a web app.
I have been following this railscast tutorial here word for word and have been running into issues with it not connecting to my local Mongodb.
I'm sure Mongodb is up and running since mongod shows up in my activity monitor and going to
http://localhost:28017/
shows:
http://imgur.com/KJ0JI.png
The problem is when I go to 0.0.0.0:3000/projects/new and try to add a new project name,
this comes up:
http://imgur.com/yxRwC.png
Here is my output when running script/server:
http://imgur.com/A9JTE.png
On my other apps, I have been using sqlite and haven't been having any issues.
I tried uninstalling mongodb and running it anyways for testing purposes and I get
the exact some issue. I guess Mongodb simply isn't being detected through rails and MongoMapper.
Anyone have any idea how to fix this thing?
I spent many hours trying to fix this and resorted to getting a stackoverflow account
and asking on here.
Let me know if there's anything else anyone needs to possibly help diagnose the problem.
Any help would be appreciated.
note: sorry, since I'm new, I can't post pictures of the errors.
I hope you can take the time to view them on imgur

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

Cucumber/Selenium newbie trying to use RoR session-data in step-definitions ... and failing

I'm spending my first few days with cucumber/selenium trying to figure out whether RBB is the thing I want to use in my latest RoR project.
My setting: Rails 2.3.5, selenium-client 1.2.17, cucumber 0.4.4 etc, quite current in my view.
Following the instructions on https://github.com/cucumber/cucumber/wiki/Setting-up-Selenium I got cucumber/selenium sorts of up and running. Simple step-definitions do work and do produce outpout that makes sense (I dont usually expect more on my first few days with anything :-) ).
My problem: I am trying to access the rails session-hash in my step-definition...and failing miserably. Refering to "session" in any "given"-clause just presents me with "undefined method `session' for nil:NilClass (NoMethodError)"
Is there any secret handshake I am missing in the docs???? Anything that has to be configured my my environment so using the session-hash is possible?
Regards
Michael
This should happen right out of the box. If you add a debugger line right to a step definition you should be able to type "session" and see something like:
{:session_id=>"f978d4220252b7e1ca51fb7319d5a365", "flash"=>{}}

Resources