首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用模型变量通过Feedzirra拉取进给

使用模型变量通过Feedzirra拉取进给
EN

Stack Overflow用户
提问于 2013-07-29 13:45:08
回答 1查看 28关注 0票数 0

我的应用程序要求用户提供他们的feed url地址。我试图将feed url传递给Feedzirra,以获取并解析该url,但我没有任何运气。

我做错了什么:

下面是我在控制器中的show方法

代码语言:javascript
复制
# 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

模型

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2013-07-29 13:46:56

代码语言:javascript
复制
url  = :url
feed = Feedzirra::Feed.fetch_and_parse(url)

在这里,url变量将始终是一个值为:url的符号。不要认为这是你想要的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17916787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档