我正在尝试为邮件列表设置一个简单的表单。
而且它似乎不允许任何rails助手生成form_for并实现身份验证令牌。
有人有幸在Radiant中安装了一个简单的form_for吗?
发布于 2011-03-07 08:45:52
在您的/your_extension.rb 中使用
def activate
Page.send :include, YourCustomTags
endyour_custom_tags.rb
module YourCustomTags
include Radiant::Taggable
tag 'custom' do |tag|
tag.expand
end
tag "custom:form" do |tag|
tag.attr['id'] ||= 'newsletter'
results = []
action = "/newsletters/"
results << %(<form action="#{action}" method="post" #{newsletter_attrs(tag)}>)
results << %(<input name="authenticity_token" type="hidden" value="#{response.instance_variable_get(:@session)[:_csrf_token]}" />)
results << tag.expand
results << %(</form>)
end这将通过真实性。
https://stackoverflow.com/questions/5213954
复制相似问题