views:

51

answers:

1

Hi guys,

I'm trying to find out where this function comes from. Any one have any clue? It's used by this:

http://github.com/fluidtickets/facebooker-authlogic-bridge

with a working example here:

http://facebooker-authlogic-bridge.heroku.com

Downloading the code, it throws: undefined method 'find_or_create_by_facebook_id' for #<Class:0xb04dd1c>

I have no clue where this function comes from.

Thanks all!

+1  A: 

Hi

ActiveRecord creates dynamic finders based on columns in your database. So for example if you have a user with a username attribute then activerecord creates a number of dynamic finders:

find_by_username
find_or_initialize_by_username #=> calls new if not found
find_or_create_by_username #=> calls create if not found

You can string a few attributes together like

find_by_username_and_email

To get back to your problem - I suspect that you haven't run some required migration that adds the facebook_id to your users table in the db and therefore ActiveRecord isn't adding the dynamic finder for facebook_id to the class.

Apie