I am very new to rails and I am trying to get an image url using Graph API inside a partial view using a controller method. How can I return the image url stored in an instance variable from the controller method to the place where I called it.
For example: I have a partial "_fb_comments.erb" and I am trying to call the controller method "fb_comments" in my "SocialMediaController" from "_fb_comments.erb" partial like this ->
<img src=<%= social_media_fb_comments_path(:comm_usr_id => "#{comm['from'['id']}" %> />
And I have my "fb_comments" controller method inside "SocialMediaController" defined like this ->
def fb_comments
user=User.find_by_id(session[:uid])
@comm_user=params[:comm_usr_id]
@get_url=Koala::Facebook::API.new(user.token)
@image_url=@get_url.get_picture(@comm_user)
render :text => @image_url
There is no view associated with this controller method. Tell me if I am missing something and how can i get this @image_url value to my <img src= /> tag in my partial view. Please help me with the code as I am completely new to rails.