Rails update_attribute问题

时间:2015-07-25 01:50:09

标签: ruby-on-rails ruby ruby-on-rails-4

我在Rails中遇到update_attribute更新程序的问题。 这是我的控制者:

1

这是我的测试:

class FeatureUpdatesController < ApplicationController
before_action :set_feature

  def backlog
    @feature.update_attribute(:deploy_status, "backlog")
    redirect_to root_path
    flash[:success] = "The status for this feature is now in the backlog"
  end

private
  def set_feature
    @feature = Feature.find(params[:id])
  end
end

而不是将deploy_status作为&#34; backlog&#34;回来,它返回为零。有这个想法吗?

1 个答案:

答案 0 :(得分:3)

我认为您必须重新加载该功能:

library(rvest) # github version library(xml2) # github version url <- "http://www.england.nhs.uk/statistics/statistical-work-areas/bed-availability-and-occupancy/" doc <- read_html(url) doc %>% html_nodes("a[href^='http://www.england.nhs.uk/statistics/bed-availability-and-occupancy/']") %>% html_attr("href") ## [1] "http://www.england.nhs.uk/statistics/bed-availability-and-occupancy/bed-data-overnight/" ## [2] "http://www.england.nhs.uk/statistics/bed-availability-and-occupancy/bed-data-day-only/"