title: Refinery CMS inquiries - NoMethodError for content_for when rendering :body content
body: <p>I'm using the 'refinerycms-inquiries' gem in my app to render an inquiry on my contact page.</p>
  
  <p>The problem that I'm getting is that although I can use the <code>&lt;%= raw @page.content_for(:body) %&gt;</code> code on my other pages to render the content, I have no idea why I'm getting this in the inquiries#new view. Maybe someone can help me solve this more quicker, because I've looked for a couple of hours on the internet for an answer and looking through the source code.</p>
  
  <p>This is the error:</p>
  
  <pre><code> NoMethodError in Refinery/inquiries/inquiries#new 
  undefined method `content_for' for nil:NilClass
  
  Extracted source (around line #3):
  
  1: &lt;% content_for :body do %&gt;
  2:     &lt;div&gt;
  3:       &lt;%= raw @page.content_for(:body) %&gt;
  4:     &lt;/div&gt;
  5: &lt;% end %&gt;
  6: 
  </code></pre>
  
  <p>I have to mention I'm a bit new to refinery and RoR.</p>
  
  <p>This is my refinery/inquiries/inquiries/new.html.erb file:</p>
  
  <pre><code>&lt;% content_for :body do %&gt;
      &lt;div class="contact"&gt;
        &lt;%= raw @page.content_for(:body) %&gt;
      &lt;/div&gt;
  &lt;% end %&gt;
  
  &lt;% content_for :body_content_left do %&gt;
      &lt;div class='inquiries'&gt;
        &lt;%= form_for [refinery, :inquiries, @inquiry] do |f| %&gt;
            &lt;%= render :partial =&gt; "/refinery/admin/error_messages",
                       :locals =&gt; {
                               :object =&gt; @inquiry,
                               :include_object_name =&gt; true
                       } %&gt;
            &lt;div class="field"&gt;
              &lt;%= f.required_label :name, :class =&gt; 'placeholder-fallback' %&gt;
              &lt;%= f.text_field :name, :class =&gt; 'text', :required =&gt; 'required', :placeholder =&gt; t('name', :scope =&gt; 'activerecord.attributes.refinery/inquiries/inquiry') %&gt;
            &lt;/div&gt;
            &lt;div class="field"&gt;
              &lt;%= f.required_label :email, :class =&gt; 'placeholder-fallback' %&gt;
              &lt;%= f.email_field :email, :class =&gt; 'text email', :required =&gt; 'required', :placeholder =&gt; t('email', :scope =&gt; 'activerecord.attributes.refinery/inquiries/inquiry') %&gt;
            &lt;/div&gt;
            &lt;div class="field"&gt;
              &lt;%= f.label :phone, :class =&gt; 'placeholder-fallback' %&gt;
              &lt;%= f.text_field :phone, :class =&gt; 'text phone', :placeholder =&gt; t('phone', :scope =&gt; 'activerecord.attributes.refinery/inquiries/inquiry') %&gt;
            &lt;/div&gt;
            &lt;div class='field message_field'&gt;
              &lt;%= f.required_label :message, :class =&gt; 'placeholder-fallback' %&gt;
              &lt;%= f.text_area :message, :rows =&gt; 8, :required =&gt; 'required', :placeholder =&gt; t('message', :scope =&gt; 'activerecord.attributes.refinery/inquiries/inquiry') %&gt;
            &lt;/div&gt;
            &lt;div class="actions"&gt;
              &lt;%= f.submit t('.send') %&gt;
            &lt;/div&gt;
        &lt;% end %&gt;
      &lt;/div&gt;
  &lt;% end %&gt;
  &lt;%= render :partial =&gt; "/refinery/content_page" %&gt;
  </code></pre>
  
  <p>This is my inquiries_controller.rb:</p>
  
  <pre><code>module Refinery
    module Inquiries
      class InquiriesController &lt; ::ApplicationController
  
        before_filter :find_page, :only =&gt; [:create, :new]
  
        def thank_you
          @page = ::Refinery::Page.find_by_link_url("/contact/thank_you")
        end
  
        def new
          @inquiry = ::Refinery::Inquiries::Inquiry.new
        end
  
        def create
          @inquiry = ::Refinery::Inquiries::Inquiry.new(params[:inquiry])
  
          if @inquiry.save
            if @inquiry.ham?
              begin
                ::Refinery::Inquiries::InquiryMailer.notification(@inquiry, request).deliver
              rescue
                logger.warn "There was an error delivering an inquiry notification.\n#{$!}\n"
              end
  
              begin
                ::Refinery::Inquiries::InquiryMailer.confirmation(@inquiry, request).deliver
              rescue
                logger.warn "There was an error delivering an inquiry confirmation:\n#{$!}\n"
              end if ::Refinery::Inquiries::Setting.send_confirmation?
            end
  
            redirect_to refinery.thank_you_inquiries_inquiries_path
          else
            render :action =&gt; 'new'
          end
        end
  
        protected
  
        def find_page
          @page = ::Refinery::Page.find_by_link_url("/contact")
        end
  
      end
    end
  end
  </code></pre>
  
  <p>And here is the config/routes.rb part that is generated by the 'refinerycms-inquiries' gem:</p>
  
  <pre><code>Refinery::Core::Engine.routes.draw do
      namespace :inquiries, :path =&gt; '' do
        get '/contact', :to =&gt; 'inquiries#new', :as =&gt; 'new_inquiry'
  
        resources :contact,
                  :only =&gt; :create,
                  :as =&gt; :inquiries,
                  :controller =&gt; 'inquiries' do
          get :thank_you, :on =&gt; :collection
        end
  
        namespace :admin, :path =&gt; 'refinery' do
          resources :inquiries, :only =&gt; [:index, :show, :destroy] do
            get :spam, :on =&gt; :collection
            get :toggle_spam, :on =&gt; :member
          end
  
          scope :path =&gt; 'inquiries' do
            resources :settings, :only =&gt; [:edit, :update]
          end
        end
      end
    end
  </code></pre>