title: Carrierwave NoMethodError: undefined method `image_url' for Item
body: <p>Please help. Two days installing Carrierwave, but stopped at errors:
   Showing /home/dima/rails_projects/my_store/app/views/items/show.html.erb where line #8 raised: <strong>undefined method `image_url' for #</strong>
  items_controller.rb:</p>
  
  <pre><code> def show
      unless @item 
        render text: "Page not here", status: 404
      end
    end
  
    def new
      @item = Item.new
    end
  
    def create
      @item = Item.create(item_params)
      if @item.errors.empty?
        redirect_to item_path(@item)
      else
        render "new"
      end
    end
  
    def update
      @item.update_attributes(item_params)
      if @item.errors.empty?
        redirect_to item_path(@item)
      else
        render "edit"
      end
    end
  
      def item_params
        params.require(:item).permit(:name, :description, :price, :weight, :real, :image_attributes)
      end
  end
  </code></pre>
  
  <p>show.html.erb:</p>
  
  <pre><code>&lt;h1&gt;&lt;%= @item.name%&gt;&lt;/h1&gt;
  &lt;ul&gt;
      &lt;li&gt;Цена: &lt;%= @item.price %&gt; грн.&lt;/li&gt;
     &lt;li&gt;Описание: &lt;%= urls_to_links(urls_to_images(@item.description)) %&gt;&lt;/li&gt;
     &lt;li&gt;Вес: &lt;%= @item.weight %&gt; кг&lt;/li&gt;
     &lt;li&gt;Реальный: &lt;%= @item.real %&gt;&lt;/li&gt;
     &lt;%= image_tag @item.image_url.to_s %&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>item.rb</p>
  
  <pre><code>class Item &lt; ActiveRecord::Base
  
    validates :price, numericality: { greater_than: 0, allow_nil: true } 
    validates :name, :description, presence: true
  
    #  has_one :image
    # accepts_nested_attributes_for :image
  end
  </code></pre>
  
  <p>image.rb</p>
  
  <pre><code>class Image &lt; ActiveRecord::Base
    mount_uploader :image, ImageUploader
    # belongs_to :imageable, polymorphic: true
  end
  </code></pre>
  
  <p>new.html.erb</p>
  
  <pre><code>&lt;h1&gt;Create new item&lt;/h1&gt;
  &lt;%= form_for @item, :html =&gt; {:multipart =&gt; true} do |f| %&gt;
    &lt;%= render partial: "form", locals: { f: f } %&gt;
    &lt;p&gt;&lt;%= f.submit "Создать товар" %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>_form.html.erb</p>
  
  <pre><code>&lt;p&gt;Наименоваие: &lt;%= f.text_field :name %&gt;&lt;/p&gt;
  &lt;p&gt;Описание: &lt;%= f.text_field :description %&gt;&lt;/p&gt;
  &lt;p&gt;Цена: &lt;%= f.text_field :price %&gt;&lt;/p&gt;
  &lt;p&gt;Вес: &lt;%= f.text_field :weight %&gt;&lt;/p&gt;
  &lt;p&gt;Реальный: &lt;%= f.text_field :real %&gt;&lt;/p&gt;
  &lt;label&gt;My Image&lt;/label&gt;
  &lt;p&gt;&lt;%= f.file_field :image %&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Tried different variants (like withouts '#'). Please help in leaning Rails.
  (Last time installed by screencast <a href="http://railscasts.com/episodes/253-carrierwave-file-uploads" rel="nofollow">http://railscasts.com/episodes/253-carrierwave-file-uploads</a> )</p>
  
  <p>Upd: 
  If I use</p>
  
  <pre><code>    def item_params
        params.require(:item).permit(:name, :description, :price, :weight, :real, :image)
      end
  </code></pre>
  
  <p>Have an error:
      TypeError: can't cast ActionDispatch::Http::UploadedFile to string: INSERT INTO "items" ("created_at", "description", "image", "name", "price", "updated_at", "weight") VALUES (?, ?, ?, ?, ?, ?, ?)</p>