I would vote for a slightly different version:

def do_new
  super
  @record.due_date = 1.hour.from_now
  ...
end

--
Volker

On 19 Feb., 20:52, Soren Christensen <[email protected]> wrote:
> You can use do_new to do what you are asking, assuming that this is
> something that happens when you create a new assignment.
>
> It goes like this and is placed in the controller file. You can assign
> defaults to every element in your models, prior to  the elements being
> displayed by AS.
> So calculated fields could look like:
>   @record.show_date = Date.today + 1.month
>
>   def do_new
>     @record = active_scaffold_config.model.new
>
>     @record.user_id = current_user.id
>
>     @record.last_name = current_user.last_name
>     @record.address = current_user.address
>     @record.city = current_user.city
>     @record.zip = current_user.zip
>     @record.home_phone = current_user.home_phone
>
>     @record
>   end
>
> /S
>
> CoolAJ86 wrote:
> > I have an assignments model which has a show date, due date, and show
> > until date.
>
> > The show date by default should be today
> > The due date by default should be 1 week from today
> > The show until date by default should be 2 weeks from today
>
> > Is there a way for me to implement this in ActiveScaffold?
>
> > Is there a way for me to implement this from Rails so that it appears
> > as I want in ActiveScaffold?
>
> > AJ ONeal

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to