The first thing you should do is to make sure this is a Rails bug. For example, you should create a fresh application with no other gem and see if the problem arises.

In that case, you could push the application source to GitHub so that others could try to replicate the behavior.

If you can't replicate this behavior in a fresh application then there is probably some gem changing the behavior of ActiveRecord. In that case you could try publishing your Gemfile.lock to a GitHub gist or a similar service and posting the link (probably on rails-talk) so that others could try to help you to identify which gem is introducing this bug.

Finally, debugging in Ruby is pretty easy. Just put a breakpoint (debugger method) before the find_by_id statement and step into it. You'll be able to investigate the stacktrace on each step to see why it is returning nil. This will certainly help you to investigate what is causing the issue.

If you find a bug in ActiveRecord, submitting a pull request with a test case for it would get your bug fixed soon.

Hope that helps,

Rodrigo.

Em 02-08-2012 16:12, yaniv pr escreveu:
Hello,

Using sqlite3, rails 3.2.2, ruby 1.9.3p125 (on windows XP)

Having the record in the db:

Shop.find(123) - returns the shop
Shop.where(:id =>  123) - returns the shop
but
Shop.find_by_id(123) returns nil
same for find_by_name, etc.

So do all the dynamic finders (notice it returns nil for integer value and for 
string values)

Why aren't they defined?

Thanks!


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to