I need to upload an image to my movie collection app. I use the operator wave to do this ( follows the steps of railscasts )
Step 1: add the gem 'carrierwave', '~> 0.9' to my Gemfile, then run the package Step 2 rails g uploader image then rails g scaffold filmes name moviestype after rake db step 3 rails g migration add_image_to_filmes image: line and then rake db
other steps are the same as railscasts
in my movie module
attr_accessible :name, :moviestype, :image
mount_uploader :image, ImageUploader
in my _form.html.erb
<%= form_for @filme, :html => {:multipart => true} do |f| %>
<% if @filme.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@filme.errors.count, "error") %> prohibited this filme from being saved:</h2>
<ul>
<% @filme.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :moviestype %><br>
<%= f.text_field :moviestype %>
</div>
<div class="field">
<br>
<%= f.file_field :image %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
in show.html.erb
<p id="notice"><%= notice %></p>
<p>
<strong>Name:</strong>
<%= @filme.name %>
</p>
<p>
<strong>Moviestype:</strong>
<%= @filme.moviestype %>
</p>
<%= image_tag @filme.image_url(:thumb) if @filme.image? %>
<%= link_to 'Edit', edit_filme_path(@filme) %> |
<%= link_to 'Back', filmes_path %>
the problem is that it didn’t load the images, but the movie name and other fields are inserted into db.how, can I fix it? need quick help.