Static pages can sometimes be a little awkward to add to a Rails app. See a couple different solutions to this problem in this episode.
# pages_controller.rb
def show
if params[:permalink]
@page = Page.find_by_permalink(params[:permalink])
raise ActiveRecord::RecordNotFound, "Page not found" if @page.nil?
else
@page = Page.find(params[:id])
end
end
# routes.rb
map.static 'static/:permalink', :controller => 'pages', :action => 'show'
# or
map.with_options :controller => 'info' do |info|
info.about 'about', :action => 'about'
info.contact 'contact', :action => 'contact'
info.privacy 'privacy', :action => 'privacy'
end
<%= simple_format @page.content%>
or
<%= textilize @page.content %>
or
<%= RedCloth.new(@page.content).to_html %>
分享到:
相关推荐
北大POJ3292-Semi-prime H-numbers 解题报告+AC代码
半柔性印刷电路板(Semi-Flex PCB),是在标准的硬板加工过程中结合入控深铣削加工或刚挠板加 工技术(铣开盖或开通窗等)获得的一种用于静态弯折领域的 PCB,常采用非对称的叠层结构,只适用 于受静态应力的安装...
Graph-based methods have been demonstrated as one of the most effective approaches for semi-supervised learning,astheycanexploittheconnectivitypatternsbetweenlabeled and unlabeled data samples to ...
In order to adapt to this phenomenon, several semi-supervised learning (SSL) algorithms, which learn from labeled as well as unlabeled data, have been developed. In a separate line of work, ...
半非负矩阵分解算法(Semi-NMF)的源代码,算法特别简练。
Semi-supervised learning with gaussian field and harmonic function. 一种利用高斯域和和谐函数的半监督分类方法.
SEMI-S2半导体制程设备安全准则
Semi-Supervised Learning
FLOWPRINT-Semi-Supervised Mobile-App.pdf
semi-supervised CCA
点状半监督流形正则化分类学习,汪云云,沈雅婷,流形正则化(MR)是经典半监督分类学习方法,同时利用有标记和无标记样本进行学习。依据流形假设,约束流形结构图上相似样本具有相��
Semi-supervised learning
Deep Learning via Semi-Supervised Embedding.pdf )
【keywords】semi-supervised learning, transductive learning, self-training,Gaussianmixturemodel, expectation maximization (EM), cluster-then-label, co-training, multiview learning, mincut,harmonic ...
半监督分类算法,其中有一些例子可供大家使用
关于Combining active learning and semi-supervised learning to construct SVM classifier的文章
第4节介绍semi-structured环境的路径规划。 free space的方法分为2部分,第1部分是采用启发式搜索方法获得一条满足车辆运动学约束的可行驶轨迹,比如Hybrid A*方法,通常结果不是最优、但接近最优。第2部分是在此...
半成品A Go game written in golang(Semi-finished).zip Java语言写的围棋小游戏。半成品A Go game written in golang(Semi-finished).zip Java语言写的围棋小游戏。半成品A Go game written in golang(Semi-...
In this paper, a novel semi-automatic 2D-to-3D conversion method is presented to estimate the disparity maps for regular 2D video shots. Our method requires only a few user-scribbles on very sparse ...
Semi-supervised Anomaly Detection using AutoEncoders全文翻译,适用于研究缺陷检测的研究者