Oui certes ...
Pour mon fichier wiki.rb, voici la méthode update_wiki (c'est un peu
long)
def update_wiki(update)
update.update_attributes(:started_on => Time.now)
bp = update.baseline_process
logger.info("Starting update of wiki #{self.title} from baseline
process #{self.baseline_process.title} (#{self.baseline_process.id})
to #{bp.title} (#{bp.id})")
logger.info("Copy update site " + bp.path + " to " + self.path)
cadmin = User.find_central_admin
# 1.
bp.copy_to(self, nil)
# 2. Update status of EPFC pages to 'undetermined'
Page.update_all( "status = 'Undetermined'", ["tool = ? and site_id
= ? ", 'EPFC', self.id, ])
# 3. Update
bp.scan4content if bp.content_scanned_on.nil?
bp.pages.each do |p|
page = Page.find_by_site_id_and_rel_path(self.id, p.rel_path)
if page
page.status = 'Updated'
no = page.max_version_no + 1
else
page = WikiPage.new(:rel_path => p.rel_path, :site =>
self, :tool => 'EPFC', :status => 'New', :site_id => self.id)
no = 0
end
# create baseversion
baseversion = BaselineProcessVersion.new(:baseline_update =>
update,:user => cadmin, :page => page,
:wiki => self, :version => no, :done =>
'Y', :note => 'Automatically created',
:baseline_process_id => bp.id)
page.baseline_process_versions << baseversion
page.save!
end
# 4.
Page.find(:all, :conditions => ['site_id = ? and status = ?',
self.id, 'Undetermined']).each do |p|
p.status = 'RemovedOrMoved'
p.save!
end
# 5.
Page.find(:all, :conditions => ['site_id = ? and tool = ?',
self.id, 'Wiki']).each do |p|
if p.harvested?
p.status = 'Harvested'
end
end
# 6.
enhance_files
# Change 68 - current versions not harvested
versions = UserVersion.find(:all, :conditions => ['wiki_id =? and
done <> ? and version is not null', self.id, 'Y'])
logger.info("Found #{versions.size.to_s} versions with unharvested
changes")
pages = versions.collect{|version| version.page}.uniq
if pages
logger.info("Found #{pages.size.to_s} pages with unharvested
changes") if pages
snippets = Page.get_snippets
pages.each do |page|
logger.info("Processing page #{page.presentation_name}")
if page.checkout
logger.info("Page has unharvested versions, we don't need to
set a current version")
else
cv = page.current_version
unless cv.nil?
if cv.current
logger.info("Page #{page.presentation_name} already has
current version with id #{cv.id}, we don't need to set a current
version")
else
logger.info("Page #{page.presentation_name} does not
have a current version")
# set the current version equal to the last version that
is not part of the update we are doing
page.current_version = Version.find(:first, :order =>
'version DESC', :conditions => ['page_id=? and version is not null and
update_id is null',page.id])
end
page.html = page.current_version.html
Page.enhance_file(page.path, snippets)
end
end
end
end
self.baseline_updated_on = Time.now
self.baseline_process = bp
self.save!
end
On 10 avr, 16:17, "ook? ook!" <[email protected]> wrote:
> 2009/4/10 Angelo <[email protected]>
>
>
>
> > Excusez moi , j'ai tellement eu de problème avec ce serveur SMTP que
> > la moindre contrariété, je lui attribue
> > J'aimerai donner du code mais moi même j'ignore où se trouve
> > exactement le problème (comme je l'ai dis l'application est développé
> > par eclipse et surtout je ne connais pas le ruby => en principe
> > j'étais pas sensé mettre mon nez dedans, juste l'installer via la
> > procédure)
>
> Moi c'est mon plus jeune chat qui me pose problème, mais je lui attribue pas
> mes boulettes, tout comme ce n'est pas mon vim qui développe mes projets
> tout seul…
>
> Balance ton fichier /app/models/wiki.rb autour de la ligne 118, sinon on ne
> peut pas faire de divination, mais je devine que c'est un problème de base
> vide, avec un contrôleur mal blindé.
>
>
>
> > Je peux vous mettre la totalité du log pour que vous m'indiquiez le
> > problème ou du moins où il se situe ...
> > NoMethodError (undefined method `title' for nil:NilClass):
> > /app/models/wiki.rb:118:in `update_wiki'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > active_record/associations/association_proxy.rb:125:in `send'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > active_record/associations/association_proxy.rb:125:in
> > `method_missing'
> > /app/models/update.rb:43:in `do_update'
> > /app/controllers/sites_controller.rb:105:in `update_now'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/base.rb:1158:in `send'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/base.rb:1158:in `perform_action_without_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:697:in `call_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:725:in `run_before_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:664:in `call'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:664:in `proxy_before_and_after_filter'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:483:in `call'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:483:in `call'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:722:in `run_before_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:695:in `call_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:689:in `perform_action_without_benchmark'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/benchmarking.rb:68:in
> > `perform_action_without_rescue'
> > P:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/benchmarking.rb:68:in
> > `perform_action_without_rescue'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/rescue.rb:199:in `perform_action_without_caching'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/caching.rb:678:in `perform_action'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > active_record/connection_adapters/abstract/query_cache.rb:33:in
> > `cache'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > active_record/query_cache.rb:8:in `cache'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/caching.rb:677:in `perform_action'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/base.rb:524:in `send'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/base.rb:524:in `process_without_filters'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/filters.rb:685:in
> > `process_without_session_management_support'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/session_management.rb:123:in `process'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/base.rb:388:in `process'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/dispatcher.rb:171:in `handle_request'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/dispatcher.rb:115:in `dispatch'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/dispatcher.rb:126:in `dispatch_cgi'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
> > action_controller/dispatcher.rb:9:in `dispatch'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/rails.rb:76:in `process'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/rails.rb:74:in `synchronize'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/rails.rb:74:in `process'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:159:in `process_client'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:158:in `each'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:158:in `process_client'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:285:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:285:in `initialize'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:285:in `new'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:285:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:268:in `initialize'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:268:in `new'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel.rb:268:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/configurator.rb:282:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/configurator.rb:281:in `each'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/configurator.rb:281:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/mongrel_rails:128:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/../lib/mongrel/command.rb:212:in `run'
> > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/
> > bin/mongrel_rails:281
> > P:/INSTAN~1/ruby/bin/mongrel_rails:19:in `load'
> > P:/INSTAN~1/ruby/bin/mongrel_rails:19
>
> > On 10 avr, 15:36, guillaume belleguic <[email protected]>
> > wrote:
> > > bonjour,
> > > Un problème smtp a bon, pourquoi ? je vois pas le smtp ???
>
> > > sinon tu as pas un object avec un champ title...
>
> > > 2009/4/10 Angelo <[email protected]>
>
> > > > Bonjour à tous,
> > > > j'ai une application rails développé par eclipse. A un moment
> > > > l'application beug et me renvoi un message d'erreur undefined method
> > > > `title' for nil:NilClass
> > > > En regardant un peu mieux les log je vois ces 2 lignes :
> > > > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > > > active_record/associations/association_proxy.rb:125:in `send'
> > > > P:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/
> > > > active_record/associations/association_proxy.rb:125:in
> > > > `method_missing'
> > > > /app/models/update.rb:43:in `do_update'
>
> > > > qui semble indiqué qu'il s'agit d'un problème smtp. Pourtant, comme je
> > > > suis sur un environnement de test j'ai ajouté l'instruction qui permet
> > > > de ne pas utiliser de serveur SMTP
> > > > config.action_mailer.delivery_method = :test
>
> > > > Auriez vous une idée du problème ?
--~--~---------~--~----~------------~-------~--~----~
Vous avez reçu ce message, car vous êtes abonné au groupe "Railsfrance" de
Google Groups.
Pour transmettre des messages à ce groupe, envoyez un e-mail à l'adresse
[email protected]
Pour résilier votre abonnement envoyez un e-mail à l'adresse
[email protected]
-~----------~----~----~----~------~----~------~--~---