yeah, it is custom coding, but isn't all your business logic going to be
custom code? What if you are required to have a start date, but your end
date could be open ended. There's really not an easy way to automate that
kind of logic.
Rails can make that kind of code easier I believe. Say you only want that
validation to work on an update.
def validate_on_update
#stuff
end
or
def validate_on_create
#stuff
end
Here's another deal. In my number fields, I'll let people enter commas. In
my model I'll add:
def before_save()
self.price = self.price_before_type_cast.gsub(",","").to_i
end
Rails un-complicates things for me. I know where things need to go and I
know the place for them. In rails, I have a model. In CF and the best
practices, you've got a model, a dao, a gateway, a transfer object, and a
bean. "Should a bean have a persist method?", "Does the model contain the
validation logic or should my bean have it?", "What should my dao return, an
object or a query?".....I consistently see these types of questions floating
about in CF-land. In CF, it might be an object you get back, it might be a
query. In Rails, I get back an array of objects or maybe just one object.
That's a lot easier for me to deal with. When I change a field in the db, I
know that every object based on that table will now have that new field. I
won't have to go into a dao, add the field to each query, go into the
gateway, add the field to each query, edit the bean, add the field to the
bean, etc.
But, I know where you're coming from. I've been doing CF pretty much
exclusively from 98 or 99 until last year. I'd still pick CF over most
every other technology.
On 4/19/06, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
>
> > it's not amazing, but in the model you would add
> >
> > def validate
> > errors.add(:start_date,"should be earlier than end_date") unless
> > start_date.nil? || start_date < end_date
> > end
>
> Exactly....right back to custom coding.
>
> So although that is a hair less code than the equivalent in CF....it's not
> so
> much better/faster/sexier/cheaper that I'm going to change the way I do
> things
> today....I will of course keep an eye on it and see how it evolves.
>
> Cheers
>
> Bryan Stevenson B.Comm.
> VP & Director of E-Commerce Development
> Electric Edge Systems Group Inc.
> phone: 250.480.0642
> fax: 250.480.1264
> cell: 250.920.8830
> e-mail: [EMAIL PROTECTED]
> web: www.electricedgesystems.com
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238200
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54