Re: [Radiant] Sessions in Radiant Help

2007-11-16 Thread Jeff Dean
I believe that this is because of a bug in rails, and not radiant.   
The SiteController has session :off, and adding session :on in your  
controllers doesn't seem to do anything.

The only way I know to change this is to actually go into  
SiteController and comment out that line.  I've seen posts about  
putting things like:

SiteController.class_eval{session :on}

in the activate method of your extension, but that didn't work for me.

To get it to work, I did froze to edge radiant, then went into  
SiteController.rb and commented out the session line.  This would mean  
that any pages that you want sessions off for you'd have to do  
manually - so use with caution.

Jeff

On Nov 16, 2007, at 9:51 PM, Maged Makled wrote:

 Hey all,
I know this discussion has taken place before but I still can't
 get my hands around it. I'm using radiant with the Rails_support
 extension which works great with radiant for the content. The  
 problem is
 when I try to use the session inside that app in the extensions, The
 session doesn't hold any data.  The session that comes with radiant  
 only
 get stuff written to it when I try to access the radiant admin app.

 Does any one have a solution for that or even a way around it. I  
 really
 appreciate the help.


 Thanks

 Maged
 -- 
 Posted via http://www.ruby-forum.com/.
 ___
 Radiant mailing list
 Post:   Radiant@lists.radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Integrating radiant in existing rails application

2007-11-16 Thread Jeff Dean
Never tried it - but you could also have a look at 
http://wiki.pluginaweek.org/Mini_radiant
On Nov 16, 2007, at 9:57 PM, Maged Makled wrote:

 arpit jain wrote:
 I need to integrate radiant in our existing rails application.
 We have our own authentication system for our site.
 I have searched and found some solutions but not upto the mark.
 I have followed the link
 http://wiki.radiantcms.org/Installation
 but it only tells to set up a new application.
 Can anybody tell me how should i proceed to achieve this.
 Thanks in advance..

 Arpit

 _
 Windows Live Spaces is here! It�s easy to create your own personal  
 Web
 site.
 http://spaces.live.com/?mkt=en-in

 Check out
 http://www.ruby-forum.com/topic/131353#new

 Thanks

 Maged
 -- 
 Posted via http://www.ruby-forum.com/.
 ___
 Radiant mailing list
 Post:   Radiant@lists.radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: [Radiant] Sessions in Radiant Help

2007-11-16 Thread Jeff Dean
Here's what I did:

gem install --include-dependencies radiant
radiant myapp
cd myapp
[change database.yml]
rake db:bootstrap
rake radiant:freeze:edge
rake radiant:update
rake db:migrate
[create extension...]

Now you'll have a full copy of radiant's source code in your vendor/ 
radiant directory.  Now go to

vendor/radiant/app/controllers

You'll see site_controller.rb (which I mistakenly referred to as  
SiteController.rb below) - comment out line 2, and sessions will now  
be enabled for the whole app.  If you've previously started your web  
server, you may have to restart for the changes to take effect.

There are much more elegant solutions, I'm sure, but this one worked  
for me.  If you have a problem with edge radiant this might not work.   
If that happens, let me know.

On Nov 16, 2007, at 10:31 PM, Maged Makled wrote:

 Jeff Dean wrote:
 I believe that this is because of a bug in rails, and not radiant.
 The SiteController has session :off, and adding session :on in your
 controllers doesn't seem to do anything.

 The only way I know to change this is to actually go into
 SiteController and comment out that line.  I've seen posts about
 putting things like:

 SiteController.class_eval{session :on}

 in the activate method of your extension, but that didn't work for  
 me.

 To get it to work, I did froze to edge radiant, then went into
 SiteController.rb and commented out the session line.  This would  
 mean
 that any pages that you want sessions off for you'd have to do
 manually - so use with caution.

 Jeff

 Thanks for your help. Could you explain your last paragraph in more
 details, I'm totally new to Radiant. where can I find the
 SiteController.rb? any examples would be very helpful

 My extension rails_support_extension.rb looks like this

 **
 require_dependency 'application'

 class RailsSupportExtension  Radiant::Extension
  version 1.0
  description Allows you to render Rails views in Radiant Layouts. 
  url http://code.google.com/p/radiant-rails-support/;

  def activate
  end

  def deactivate
  end

  SiteController.send :include, SiteControllerExtension
  SiteController.helper SiteHelperExtension

 end
 **

 Thanks in advance
 Maged Makled
 -- 
 Posted via http://www.ruby-forum.com/.
 ___
 Radiant mailing list
 Post:   Radiant@lists.radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Sessions in Radiant Help

2007-11-16 Thread Jeff Dean
I haven't dealt with that before, but if I were to do it, I would:
Determine what I meant by expired (let's say 3 days for example)
Write a rake task that deletes the session
Write a cron script to run it nightly after the database backup

My rake task would probably look like:

namespace :db
   namespace :sessions
 task :delete = :environment do

CGI::Session::ActiveRecordStore::Session.delete_all(['created_at  ?',  
3.days.ago])
 end
   end
end

My cron script would look something like this:

mkdir -p /var/backup/mysql
date=`date +%d`
mysqldump -ubackup -pmypass myapp_production | gzip  /var/backup/ 
mysql/myapp-$date.sql.gz
cd /var/www/apps/myapp/current  rake db:sessions:delete

Alternately, you could have it run every time an admin logs in  
(assuming that your admins don't mind the slight performance hit)

Jeff

On Nov 16, 2007, at 11:54 PM, Maged Makled wrote:

 Jeff Dean wrote:
 Here's what I did:

 gem install --include-dependencies radiant
 radiant myapp
 cd myapp
 [change database.yml]
 rake db:bootstrap
 rake radiant:freeze:edge
 rake radiant:update
 rake db:migrate
 [create extension...]

 Now you'll have a full copy of radiant's source code in your vendor/
 radiant directory.  Now go to

 vendor/radiant/app/controllers

 You'll see site_controller.rb (which I mistakenly referred to as
 SiteController.rb below) - comment out line 2, and sessions will now
 be enabled for the whole app.  If you've previously started your web
 server, you may have to restart for the changes to take effect.

 There are much more elegant solutions, I'm sure, but this one worked
 for me.  If you have a problem with edge radiant this might not work.
 If that happens, let me know.

 Hey Jeff,
 Thanks a lot man, I tried it and it works perfectly.  Just one
 more question. Do you know how to delete that session from the  
 database
 when the session expired. I read some posts and they talked cron jobs
 and things like that but I needed to be handled in my application. Do
 you have a quick solution?

 I really appreciate your help man

 Maged
 -- 
 Posted via http://www.ruby-forum.com/.
 ___
 Radiant mailing list
 Post:   Radiant@lists.radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Has anyone used the PluginAWeek Version?

2007-11-14 Thread Jeff Dean
Has anyone played around with http://api.pluginaweek.org/mini_radiant/?

It sounds like a great idea - and it seems like it would make it a lot  
easier to port existing rails apps - something like:
  * piston all of the plugins
  * update some configs to fix the load order
  * run some migrations

On my end, the fact that everything in radiant has to be an extension  
is proving very tough for me.  I have 10+ plugins in each of my rails  
apps, and loading them into radiant is a chore - and if any other  
extensions ever use similar plugins, it seems like it could cause  
trouble.

I've spent a while now trying to learn extensions, so I don't really  
want to make the switch unless it really makes sense.  Anyone have any  
feedback on the mini-radiant?

Jeff
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Regular Rails Script Generate

2007-11-10 Thread Jeff Dean
I've got the latest revision of Radiant from trunk (r596) and I also  
downloaded and configured the RadiantOnRails extension (very slick, by  
the way).  I'd like to be able to use script/generate for the main  
rails app, but it's not recognizing the standard generators.

Does anyone know how to use script/generate migration etc... in an app  
that's based on Radiant?
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Integrating with Existing Rails Apps

2007-11-10 Thread Jeff Dean
I've got a few existing sites that I'd like to add radiant to.  Each  
of them has a more complicated user management setup (multiple roles/ 
permissions) and lots of dynamic content.

I got going with radiant_on_rails and share_layouts so I can get my  
app to look like the Radiant app, but I can't figure out how do deal  
with migrations or overriding the default admin screens.

Migrations:

If I add migrations to RAILS_ROOT/db/migrate, and they have numbers  
less-than the highest number in the RADIANT_ROOT gem migrations, then  
the migrations don't run.  If they have numbers greater than the  
highest number in RADIANT_ROOT/db/migrate, they run, but this seems  
hackish.

I realize that I can write an extension that migrates via  
db:migrate:extensions, but my apps are already fully formed, and I  
need to write several migrations to coerce the existing data into the  
new format.  In that sense even if I wanted to put the code in the  
extensions, the migrations really belong in the app itself, not the  
extension, because the extension would be completely un-reusable.

For folks who use radiant_on_rails:  how do you migrate?

Overriding Views:

I have in my app an admin/user/index.rhtml view, and I've added the  
RAILS_ROOT/app/views above RADIANT_ROOT/app/views in environment.rb.   
But when I go to the user screen, I still see the built-in view.  How  
can I overwrite these in my extensions/main rails app?

Jeff

___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant