Change default values

I need to change the default values inserted by radiant in published_at
column.
In the old version of Radiant I created sites with all controllers,
models etc in the site so I modified them to avoid that the default
values was inserted in the db.
But now I migrated to the new version of Radiant 0.6.1 and all the code
of Radiant is in the gem. How can I ovewrite the default functionality
and insert my values in published_at column?
Thanks in advance


Francesco L.
Ymir s.r.l.
Viale Verona 190/11
38100 Trento

Francesco L. wrote:

In the old version of Radiant I created sites with all controllers,
models etc in the site so I modified them to avoid that the default
values was inserted in the db.
But now I migrated to the new version of Radiant 0.6.1 and all the code
of Radiant is in the gem. How can I ovewrite the default functionality
and insert my values in published_at column?

Can you use the console?

$ script/console productionLoading production environment.

page = Page.find_by_url(‘/’)
=> #<Page:0x365b8fc @parent=, @attributes={“virtual”=>“0”, …
page.published_at = Date.parse(‘1/1/2000’)
=> #<Date: 4903089/2,0,2299161>
page.save!
=> true


John L.
http://wiseheartdesign.com

John W. Long ha scritto:

Can you use the console?

Yes I can use console but what I nedd is a little different.
I know that I am perverting the nature of Radiant, but I am trying to
adapt it to the needs of my silly customers. (Why customers are quite
always silly?)
I created a form and a script that parse the form and insert it in the
radiant structure adding correct page parts etc.
The customer need to upload press releases, the page is made with
different parts: title, description, link (to a pdf tha is upload in
the form) date.
Every time the customer compile the form I need to insert a date written
by the customer that could be different form the actual date.
I changed the code in the gem, but I would prefer to do a cleaner job
becasue changing the gem changes every radiant site on the same machine.
(Fortunately I have only one site for the moment)


Francesco L.
Ymir s.r.l.
Viale Verona 190/11
38100 Trento

Francesco L. wrote:

by the customer that could be different form the actual date.
I changed the code in the gem, but I would prefer to do a cleaner job
becasue changing the gem changes every radiant site on the same machine.
(Fortunately I have only one site for the moment)

You could probably create what you need with an extension.


John L.
http://wiseheartdesign.com

On May 15, 2007, at 5:25 AM, Francesco L. wrote:

I changed the code in the gem, but I would prefer to do a cleaner job
becasue changing the gem changes every radiant site on the same
machine.
(Fortunately I have only one site for the moment)

While it’s still a little ugly, you’d probably be better off freezing
radiant to that one site and hacking it there. That way your gem is
still pristine and can be updated as needed without breaking your
changes. Just run rake radiant:freeze:gems (I think) and it will
unpack your gem (as it currently stands) into the vendor directory.
You can then reinstall a pristine copy of the radiant gem for other
sites.

Of course, the only truly clean way of doing it would be through an
extension, but the above could be done quickly.

Matt