regmiprem
regmiprem

Reputation: 735

i want to implement soundtrack in my rails app

Hey i did just like this tuotorial for my rails app https://github.com/soundcloudlabs/connect-with-soundcloud-rails-demo also there is a video http://www.youtube.com/watch?v=oSBfGV0uUA4 I watch this and implement this as it taught. But i get 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

Is there any idea how this can be solve? My sound cloud controller is like this

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

Upvotes: 0

Views: 115

Answers (1)

Tarang
Tarang

Reputation: 75945

If your code is the same as the one on github the problem is at line 9

me = soundcloud_client.get('/me')

Maybe you have something like soundcloud_client.get? Could you show your code for the file SoundCloud controller and check this line is correct

Upvotes: 1

Related Questions