Ruby on rails 3.2 使用模型变量通过Feedzirra拉动进给
我的应用程序要求用户提供他们的源url地址。我试图将提要url传递给Feedzirra以获取和解析url,但我没有任何运气 我做错了什么: 这是我在控制器上的显示方法Ruby on rails 3.2 使用模型变量通过Feedzirra拉动进给,ruby-on-rails-3.2,Ruby On Rails 3.2,我的应用程序要求用户提供他们的源url地址。我试图将提要url传递给Feedzirra以获取和解析url,但我没有任何运气 我做错了什么: 这是我在控制器上的显示方法 # 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
# 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分数
在这里,url
变量始终是一个符号,其值为:url
。别以为这是你想要的
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
url = :url
feed = Feedzirra::Feed.fetch_and_parse(url)