search for: to_prepare

Displaying 8 results from an estimated 8 matches for "to_prepare".

Did you mean: log_prepare
2011 Sep 21
0
hooking into `to_prepare` in a Railtie *after* the files have been reloaded (in dev)
...eves this. My problem however is that in dev mode, these classes are reloaded, so they don''t maintain these values set. So I thought I''d use a railtie to hook into the point where these files are reloaded and run my config again on the models. My problem however is that config.to_prepare in the railtie appears to run before the reload! actually takes place. I can prove this with a bit of logging: module MyMod class Railtie < Rails::Railtie config.to_prepare do Rails.logger.debug("Contact object_id: #{Contact.object_id}") end end end if I load up m...
2011 Apr 08
5
How to extend a helper using plugin?
Hello, I''m facing this problem while trying to extend the parse_redmine_links helper method in Redmine-1.1.0 (Rails-2.3.5) from my plugin. My idea is to use alias_method_chain so the extended version could call the original version and adjust the result to it''s liking. Anything I''ve tried so far exposes this behavior: the first render of a page uses the extended
2006 Aug 08
2
Extending rails with plugins
I''ve been looking at bottling some functionality up into a plugin, but I''m having some problems including it. The structure I have is: /app/controllers/admin/base_controller.rb: class Admin::BaseController > ApplicationController #snip# end /vendor/plugins/myplugin/lib/my_module.rb: module MyModule def new_func "New Function" end end
2008 May 21
2
Replacing ActiveRecordStore::Session with a custom model
Has anyone managed to replace ActiveRecordStore::Session with their own model? In the source (http://dev.rubyonrails.org/browser/trunk/actionpack/lib/ action_controller/session/active_record_store.rb) it says you can override the default by setting CGI::Session::ActiveRecordStore.session_class = MySessionClass I have tried doing this in a number of ways but I get all kinds of weird errors, as
2008 Aug 24
2
config.after_initialize and development mode
Hi, I''m using activemerchant and setting up a class variable using config.after_initialize. It works great for the first request, but then the variable is nil. config.after_initialize do ActiveMerchant::Billing::Base.mode = :test OrderTransaction.gateway = ActiveMerchant::Billing::PaypalGateway.new(...) end I''m assuming this is is due to the model reloading after each
2011 May 29
4
Model load time
...Curso Legislacao Usuario And I have another model that is loaded from a gem Im trying to build: Cidade My gem is actually a simple engine: require ''active_record'' require ''my_gem/app/models/cidade'' module MyGem class MyGemEngine < Rails::Engine config.to_prepare do puts ActiveRecord::Base.descendants end end When I start the server it prints, as expected: => Booting Mongrel => Rails 3.1.0.rc1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Cidade => Debugger enabled...
2011 Dec 22
0
Problems with database config and prepare_to method
...connecting to the database specified in the database.yml file. After some research I figured out that one of my custom plugins is causing the problem. The problem is comming from the initializer of the plugin where I do : require "#{File.dirname(__FILE__)}/lib/fianet_order" config.to_prepare do if AppConfig.fianet.enabled load_fianet end end We need to use the config.to_prepare because we want that it only loads 1 time when it is the production environment and reload everytime in development mode. In load_fianet we do a class_eval on a model to add some spe...
2013 May 09
0
Rails 4.0.0.rc1 - A copy of <class> has been removed from the module tree but is still active!
...change (even adding/removing a comment) to a source file and then sending a request. The error goes away after restarting the server but if I made a code change again and send a request, the error would appear again. This is what is in development.rb for reloading Reference::Base. * * *config.to_prepare do * * Reference::DataTypes.reload if ActiveRecord::Base.connection.table_exists? ''reference_data_lists''* * end* I found several other older posts that talk about this topic. One being [1]. Adding "*ActiveSupport::Dependencies.autoload_once_paths << "#{R...