嘿,我只是喜欢我的 Rails 应用程序的教程 https://github.com/soundcloudlabs/connect-with-soundcloud-rails-demo 还有一个视频http://www.youtube.com/watch?v=oSBfGV0uUA4 我看着它并按照它的教导来实施它。但我得到错误
ArgumentError in SoundcloudController#connected
wrong number of arguments (0 for 1)
Rails.root: /home/prem/Desktop/souncloud/connect-with-soundcloud-rails-demo
Application Trace | Framework Trace | Full Trace
app/controllers/soundcloud_controller.rb:9:in `connected'
Request
Parameters:
{"code"=>"12c142cb2626b9c314ea25af87cbad48",
"signed_up"=>"0"}
Show session dump
Show env dump
Response
Headers:
None
有什么想法可以解决吗?我的声音云控制器是这样的
class SoundcloudController < ApplicationController
def connect
redirect_to soundcloud_client.authorize_url(:display => "popup")
end
def connected
if params[:error].nil?
soundcloud_client.exchange_token(:code => params[:code])
me = soundcloud_client.get("/me")
login_as User.find_or_create_by_soundcloud_user_id({
:soundcloud_user_id => me.id,
:soundcloud_username => me.username
})
current_user.update_attributes!({
:soundcloud_access_token => soundcloud_client.access_token,
:soundcloud_refresh_token => soundcloud_client.refresh_token,
:soundcloud_expires_at => soundcloud_client.expires_at,
})
end
render :layout => false
end
def disconnect
login_as nil
redirect_to root_path
end
private
def soundcloud_client
return @soundcloud_client if @soundcloud_client
@soundcloud_client = User.soundcloud_client(:redirect_uri => soundcloud_connected_url)
end
end