[Osirails-dev-core] core features improve
Mathieu Fontaine
spidou at gmail.com
Mon Mar 9 06:58:15 EDT 2009
Benjamin,
Did you test all the code you have putted in your branch
core_features_improve ?
I merge your branch in mine to get your modifications, but it doesn't
work!! The files "overrides.rb" of the features are not properly loaded
at every page as they should be, according to the code you wrote in the
ApplicationController. The first time I display a page it works, but the
second time I've got an error which says the User model don't have any
"employee" method. In fact, ApplicationController itself is not called
at every page.
However, when I put your code in a method of the ActionController class,
and set up a before_filter to call it every time, that's works fine.
class ApplicationController < ActionController::Base
...
before_filter :load_overrides if RAILS_ENV == "development"
...
private
def load_overrides
# Manage the override of each features
# OPTIMIZE Move this block of code to a better place
features = Dir.open("#{RAILS_ROOT}/lib/features")
features.sort.each do |dir|
next if dir.starts_with?('.')
# next if !Feature.find_by_name(dir).activated?
file_path = "#{RAILS_ROOT}/lib/features/#{dir}/overrides.rb"
load file_path if File.exist?(file_path)
end
end
end
Can you tell me how could you put the code where you've done without
errors ?
--
Spidou
Promouvoir et soutenir le logiciel libre
<http://www.april.org/adherer?referent=Mathieu%20FONTAINE+%28mfontaine%29>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/osirails-dev-core/attachments/20090309/59c419a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: banniereadm6.php
Type: image/png
Size: 9994 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/osirails-dev-core/attachments/20090309/59c419a7/attachment.png>
More information about the Osirails-dev-core
mailing list