Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes "Attempt to call private method" error #37

Open
wants to merge 1 commit into from

8 participants

@nathenharvey

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:in
initialize'
/Users/nharvey/projects/webistrano/app/models/stage.rb:125:in new'
/Users/nharvey/projects/webistrano/app/models/stage.rb:125:in
list_tasks'
/Users/nharvey/projects/webistrano/app/controllers/stages_controller.rb:17:in show'
/Users/nharvey/projects/webistrano/app/controllers/application_controller.rb:24:in
set_timezone'

Request

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

Show session dump
Response

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

@alexspeller

Your way is better, but I submitted this pull request a while ago: alexspeller@27a3589

Please fix this also on line 44:

    # actual invokment of a given task (through @deployment)
    def invoke_task!
      options[:actions] = deployment.task

Deployments don't work unless you do. I just changed it to deployment[:task] and it works.

@jmound

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

@matt-stuart

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

25: if(!@deployment.new_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.

@harmon

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

@thetimbanks

This fixed the issue for me as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/webistrano/deployer.rb
View
2  lib/webistrano/deployer.rb
@@ -22,7 +22,7 @@ def initialize(deployment)
@deployment = deployment
- if(@deployment.task && !@deployment.new_record?)
+ if(!@deployment[:task].nil? && !@deployment.new_record?)
# a read deployment
@logger = Webistrano::Logger.new(deployment)
@logger.level = Webistrano::Logger::TRACE
Something went wrong with that request. Please try again.