Forums | Admin

Discussion Forums: drysql_help

Start New Thread Start New Thread

 

By: Bryan Evans
RE: Disabling drysql for one class [ reply ]  
2007-02-23 17:03
Thanks for the update. I'll check your patch into SVN for the next release

By: Juan Tarquino
RE: Disabling drysql for one class [ reply ]  
2007-02-22 01:48
I found my problem: in the base.rb in the drysql gem, the initialize method was not sending the hash attributes to the base class. Here is the method modified:
def initialize(attributes = nil)
self.class.generate_associations
self.class.generate_validations
base_initialize(attributes)
#(before it was just base_initialize)
end

By: Bryan Evans
RE: Disabling drysql for one class [ reply ]  
2007-02-19 16:45
Hi Juan

There is currently no way to disable DrySQL's association and validation generation for a class, though it can certainly be added if there is a need for it.

The behaviour you describe would suggest that DrySQL has generated validations for your model and is enforcing them. Given that these validations are retrieved from your DB, I can't imagine why you'd want to disable them. If your Username column is specified on your DB to have a minimum of 3 characters then you might as well enforce this at the application level because an attempt to insert such a record into your DB will produce a failure.

Let me know if I have misunderstood your scenario

Cheers.

- Bryan

By: Juan Tarquino
Disabling drysql for one class [ reply ]  
2007-02-17 15:11
How can I disable drysql for only one class? I am having problems when using Hobo user model with drysql: it does not let me create a new user, it tells me that Username is too short (minimum is 3 characters) and Username can't be blank.