Google Groups Home
Help | Sign in
Message from discussion application.rb -> application_controller.rb
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Xavier Noria  
View profile
 More options Jan 13, 4:00 pm
From: Xavier Noria <f...@hashref.com>
Date: Sun, 13 Jan 2008 22:00:30 +0100
Local: Sun, Jan 13 2008 4:00 pm
Subject: Re: [Rails-core] Re: application.rb -> application_controller.rb
On Jan 13, 2008, at 6:21 PM, ara.t.howard wrote:

> a great example is

>   ApplicationModel < ActiveRecord::Base
>     before_save do |record|
>       record.updated_by = ApplicationController.current if
>         record.respond_to? 'updated_at'
>     end
>   end

Yes, custom macros would go there as well... it has use cases.

> which, of course, can be done in rails but only with a series of
> monkey patches.  do you really think it's clear to people a) how to
> do this, b) where it should go?  i really don't but maybe i'm just
> not rails-y enough.

I think it would be expected to emulate what's done with  
ApplicationController. That is, the rails generator would write

   app/models/application_model.rb

with something like

   class ApplicationModel < ActiveRecord::Base
     # Stuff common to your models comes here.
   end

and the model generator would output something like this

   class User < ApplicationModel
   end

Active Record would understand ApplicationModel is abstract as a hard-
coded builtin assumption.

-- fxn


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google