webistrano icon indicating copy to clipboard operation
webistrano copied to clipboard

Fixes "Attempt to call private method" error

Open nathenharvey opened this issue 13 years ago • 5 comments

This resolves an error with the StagesController trying to show a stage. It's throwing an error as shown below.

Thanks, Nathen

NoMethodError in StagesController#show

Attempt to call private method

RAILS_ROOT: /Users/nharvey/projects/webistrano Application Trace | Framework Trace | Full Trace

/Users/nharvey/projects/webistrano/vendor/bundler/ruby/1.8/gems/activerecord-2.3.11/lib/active_record/attribute_methods.rb:236:in method_missing' /Users/nharvey/projects/webistrano/lib/webistrano/deployer.rb:25:ininitialize' /Users/nharvey/projects/webistrano/app/models/stage.rb:125:in new' /Users/nharvey/projects/webistrano/app/models/stage.rb:125:inlist_tasks' /Users/nharvey/projects/webistrano/app/controllers/stages_controller.rb:17:in show' /Users/nharvey/projects/webistrano/app/controllers/application_controller.rb:24:inset_timezone'

Request

Parameters: {"project_id"=>"1", "id"=>"1"}

Show session dump Response

Headers: {"Content-Type"=>"", "Cache-Control"=>"no-cache"}

nathenharvey avatar Jul 21 '11 22:07 nathenharvey

+1 ...would merge again. (I had this error, made the change, and as far as I can tell, all is sunshine again)

jmound avatar Aug 11 '11 15:08 jmound

I believe that if you reverse the conditionals in the if it should be fine.

25: if([email protected]_record? && @deployment.task)

I noticed, during debugging, that if I asked for the description first and then the task it worked fine.

24: Rails.logger.error "Desc: #{@deployment.description}"
25: Rails.logger.error "Task: #{@deployment.task}"

Putting task first or removing description line caused it to fail. Interesting tidbit.

Edit: I may have spoken too soon. My fix allows for the page to load (likely due to short circuiting) but it fails during an actual deployment load.

matt-stuart avatar Aug 11 '11 19:08 matt-stuart

+1 for this fix! Please put it in! It's broken.

harmon avatar May 25 '12 23:05 harmon

This fixed the issue for me as well. Thanks!

thetimbanks avatar May 30 '12 13:05 thetimbanks

:+1:

cedriclombardot avatar Jul 20 '12 11:07 cedriclombardot