我想在rails应用中实现配乐



嘿,我只是喜欢这个教程为我的rails应用程序https://github.com/soundcloudlabs/connect-with-soundcloud-rails-demo还有一个视频http://www.youtube.com/watch?v=oSBfGV0uUA4,我看了这个,并按照教的那样实施。但是我得到error

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

如果你的代码与github上的代码相同,问题在第9行

me = soundcloud_client.get('/me')

也许你有像soundcloud_client.get这样的东西?你能展示一下SoundCloud controller文件的代码并检查这一行是否正确吗

相关内容

  • 没有找到相关文章

最新更新