ActiveRecord "Rando's" PDF Print E-mail
Written by Sean Henderson   
Wednesday, 19 November 2008 03:20

I am currently entrenched in ActiveRecord – trying to learn it and implement it on a project. There seems to be a lot of practical documentation and examples missing on the net (or my search skills have severely diminished).

Anyway – I hope to put together a few postings on my learnings to try and save you some time should you run into the same problems.

Here’s the first:

“Could not perform SlicedFindAll for ClassName

I’m trying to create a new user, and attach a company that was populated into a select list.

This is the line that caused the error:

Company.Find( lbCompany.SelectedValue );

Apparently, despite the fact that the Expression function I’m calling takes an Object as for the value, it won’t convert it to the appropriate type. This caused me many headaches trying to search through 285MB of log files (created just from the init and few calls I make to log4net before this point). I was unable to get the same result in my unit tests because I was passing in an actualy Int32.

So – convert the value to an Int32 (assuming your primary key is an Int32), and you should be fine.

Company.Find(Convert.ToInt32(lbCompany.SelectedValue));

Good luck.

Shendy.

Trackback(0)
Comments (0)add
Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security image
Write the displayed characters


busy
Last Updated on Sunday, 23 November 2008 23:01