这是“.rb”文件:
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def bg
@images = ["bg1.jpg", "bg2.jpg", "bg3.jpg", "bg4.jpg", "bg5.jpg","bg6.jpg","bg7.jpg","bg8.jpg"]
@random_no = rand(8)
@random_image = @images[@random_no]
end
end
这是“css.scss”文件:
#welcome
{
background-image:url();
}
我希望background-image
显示@random_image
,但我不知道url()
中的内容应该是什么。
谢谢!