First off, I'm pretty new to Ruby on Rails and the SoundCloud API so sorry if this is a stupid question.
My problem is, I'm trying to use the SoundCloud resolve track feature to get track information about a post.
Right now I have a scaffold set up that runs through each post using the
<% @posts.each do |post| %>
<%= post.soundcloud %>
<% end %>
.soundcloud
is just the url of the song that I want to be resolved.
I've tried
<%= @client.get('/resolve', :url => <%= post.soundcloud %> ) %>
But then realized I can't have nested erb tags.
I've also tried passing various methods in the controller but I can't seem to figure it out.
Oh, here is what my controller looks like.
def index
require 'soundcloud'
@posts = Post.all
@client = Soundcloud.new(:client_id => 'MY_CLIENT_ID')
@tracks = @client.get('/resolve', :url => '') <-- Don't know what to do with this
end
Any suggestions?
Thanks in advance
I didnt check the documentation, but from looking at your code your erb file should be
<% @posts.each do |post| %>
<%= @client.get('/resolve', url: post.soundcloud ) %>
<% end %>