« Return to Thread: Google App Engine Rails Template

Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View in Thread


Hi Christian

Thanks for the code sample.

I am very eager to use a standard Ruby development environment for App Engine without restarts as you have described.

I have spent several hours trying to use your code sample to configure a Rails project with GAE but so far have been unsuccessful.

Have you made any other significant changes to your Rails app besides what you mentioned?

Thanks,
Carson



 
From: Christian Seiler <chr.seiler@...>
Date: Mon, Jun 15, 2009 at 5:37 AM
To: user@...


My workaround in development mode so far: Simply using Webrick as usual
plus setting up the datastore in the controller (application_controller.rb).

 if Rails.env=='development'
   before_filter :setup_datastore
   after_filter  :teardown_datastore
 end

 protected

   if Rails.env=='development'
     import com.google.apphosting.api.ApiProxy
     import com.google.appengine.api.datastore.dev.LocalDatastoreService
     import com.google.appengine.tools.development.ApiProxyLocalImpl

     class DevEnvironment
       include ApiProxy::Environment
       def app_id
         'Dev Environment'
       end
     end

     def setup_datastore
       ApiProxy.environment_for_current_thread = DevEnvironment.new
       ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
java.io.File.new('.')
       #ApiProxy.delegate.set_property
LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
     end

     def teardown_datastore
       #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
       ApiProxy.delegate = nil
       ApiProxy.environment_for_current_thread = nil
     end
   end
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





 « Return to Thread: Google App Engine Rails Template