From spidou at gmail.com Mon Mar 9 06:58:15 2009 From: spidou at gmail.com (Mathieu Fontaine) Date: Mon, 09 Mar 2009 14:58:15 +0400 Subject: [Osirails-dev-core] core features improve Message-ID: <49B4F647.6090608@gmail.com> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: banniereadm6.php Type: image/png Size: 9994 bytes Desc: not available URL: From Benjamin.LAN-SUN-LUK at supinfo.com Mon Mar 9 07:18:40 2009 From: Benjamin.LAN-SUN-LUK at supinfo.com (LAN-SUN-LUK Benjamin) Date: Mon, 9 Mar 2009 12:18:40 +0100 Subject: [Osirails-dev-core] core features improve In-Reply-To: <49B4F647.6090608@gmail.com> Message-ID: I have swiched to the branch core_features_improve (rev. 1697), start the server, It works. I got no problem with User or Calendar model. Do you have any errors when launch the server with the branch core_features_improve ? -- Benjamin LAN-SUN-LUK Le 09/03/09 11:58, ? Mathieu Fontaine ? a ?crit : 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 ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From spidou at gmail.com Mon Mar 9 08:36:43 2009 From: spidou at gmail.com (Mathieu Fontaine) Date: Mon, 09 Mar 2009 16:36:43 +0400 Subject: [Osirails-dev-core] core features improve In-Reply-To: References: Message-ID: <49B50D5B.3080002@gmail.com> No no, there is no problem when I start the server. But when I try to display a page in the browser. The first time it's ok, but if a press F5 to reload the page, it doesn't work until I restart the server. I've got an error at any page because the error occurs in the header page when we try to display the fullname of the employee associated to the logged in user (Welcome, John Doe) but the association is not recognized the second time. When I tried to see if your code in application.rb were reached (with any 'puts' calls) when I load a page, I notice the messages were not displayed. I'll retry with a fresh checkout of the svn repo and keep you informed. Tell me if you found anything. Thanks. -- Spidou LAN-SUN-LUK Benjamin wrote: > I have swiched to the branch core_features_improve (rev. 1697), start > the server, It works. > I got no problem with User or Calendar model. > > Do you have any errors when launch the server with the branch > core_features_improve ? > > -- > Benjamin LAN-SUN-LUK > > > > Le 09/03/09 11:58, ? Mathieu Fontaine ? a ?crit : > > 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 ? > > ------------------------------------------------------------------------ > > _______________________________________________ > Osirails-dev-core mailing list > Osirails-dev-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/osirails-dev-core > -------------- next part -------------- An HTML attachment was scrubbed... URL: