Sunday, June 29, 2008

Something frustrating in activerecord

yep, another data mining project started. during the last few months, i managed to work out the algorithm. the professor got me some real dataset in some company, now it's the time to try the new bees. as usual, try to dump the plain txt file into mysql and write ruby code to handle them, the main reason is ruby is pretty agile language. i mean you can modify it without lots of effort. just write the code and go. everything works well, like speak a language. pretty satisfied. data analysis work in my last few projects only use activerecord and did not use rails at all. the problem is activerecord 2.1.0 seems can only be a plain java bean like class, and can not have any self defined methods in it ?? i hope no. but why recently at least two times, my class which extends ActiveRecord::Base which i added some instances methods, the 'save' and 'create' in ActiveRecord just do not work at all. it always pops out some errors like this :

transaction.rb line xxx, no delete method for NilClass

I've no idea how to deal with this error yet. in my memory when i still work on web development, the activerecord did not have such errors. oops = - . my current solution is comment out all the self defined code only left activereocd specifed code there. like has_many, belongs_to, set_table_name. after the data import work, dump the database, and then add what code i want, and begin analysis. actually no solution in this case.

No comments:

Post a Comment