Ruby on Rails アプリのマークダウンで Ruby を使用することはできますか? 私は RedCarpet gem を使用しており、アプリケーション コントローラーには次のものがあります。
class ApplicationController < ActionController::Base
  before_filter :get_contact_info
  private
    def get_contact_info
      @contact = Contact.last
    end
  end
これがContactのスキーマです
create_table "contacts", :force => true do |t|
  t.string   "phone"
  t.string   "email"
  t.string   "facebook"
  t.string   "twitter"
end
作業する連絡先情報があります。マークダウンレンダラーに <%= @contact.phone %> をプレーンテキストではなく @contact.phone の値としてレンダリングするように指示する方法はありますか? または、そのためにマークダウン以外のものを使用する必要がありますか?
編集1:
ここでマークダウンをレンダリングします:
アプリ/ヘルパー/application_helper.rb
def markdown(text)
  options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis]
  Redcarpet.new(text, *options).to_html.html_safe
end
アプリ/ビュー/サイト/show.html.erb
<%= markdown(site.description) %>
編集2:
これが私の解決策でした、ありがとう。あなたのコードをマークアップ ヘルパーに統合しました。これは今のところ機能しているようです。
def markdown(text)
  erbified = ERB.new(text.html_safe).result(binding)
  options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis]
  Redcarpet.new(erbified, *options).to_html.html_safe
end