Forum: Radiant CMS change default values

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
75f2022f13e4e677d080a2009c8a6dfb?d=identicon&s=25 Francesco Lunelli (Guest)
on 2007-05-13 02:20
(Received via mailing list)
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 Lunelli
Ymir s.r.l.
Viale Verona 190/11
38100 Trento
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2007-05-15 01:42
(Received via mailing list)
Francesco Lunelli 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 Long
http://wiseheartdesign.com
75f2022f13e4e677d080a2009c8a6dfb?d=identicon&s=25 Francesco Lunelli (Guest)
on 2007-05-15 12:27
(Received via mailing list)
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 Lunelli
Ymir s.r.l.
Viale Verona 190/11
38100 Trento
88b8fe9e9bc03bd33208830fa612dc50?d=identicon&s=25 Matt Bauman (Guest)
on 2007-05-15 16:12
(Received via mailing list)
On May 15, 2007, at 5:25 AM, Francesco Lunelli 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
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2007-05-15 17:20
(Received via mailing list)
Francesco Lunelli 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 Long
http://wiseheartdesign.com
This topic is locked and can not be replied to.