我的应用程序要求用户提供他们的feed url地址。我试图将feed url传递给Feedzirra,以获取并解析该url,但我没有任何运气。
我做错了什么:
下面是我在控制器中的show方法
# GET /scores/1
# GET /scores/1.json
def show
#@score=Score.find(params[:id])
@score = current_user.scores.find(params[:id])
url=:url
feed=Feedzirra::Feed.fetch_and_parse(url)
@entry=feed.entries
respond_to do |format|
format.html #show.html.erb
format.json {render json: @score }
end模型
class Score < ActiveRecord::Base
belongs_to :user
validates :user_id, presence: true
attr_accessible :title, :postFrequency, :editorialCalendar, :postTemplate,
:headlineVariations, :publishingScore, :professionalLogo, :colorScheme, :typographyStandards,
:seoPlugin, :googleAnalytics, :setupScore, :sb_promotion_1, :sb_promotion_2, :sb_recentPosts,
:sidebarScore, :leadMagnet, :emailCampaign, :productCreated, :landingPage, :monetizationScore, :url,
:name, :summary, :url, :published_at, :guid
end发布于 2013-07-29 13:46:56
url = :url
feed = Feedzirra::Feed.fetch_and_parse(url)在这里,url变量将始终是一个值为:url的符号。不要认为这是你想要的。
https://stackoverflow.com/questions/17916787
复制相似问题