Skip to content

Commit

Permalink
Merge pull request #137 from Hamatti/image-uploading-addition
Browse files Browse the repository at this point in the history
Added an extra step for image uploader.
  • Loading branch information
vesan committed Jan 25, 2014
2 parents 75aa71c + a5ae716 commit acaaffe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions _posts/2012-04-18-app.markdown
Expand Up @@ -334,6 +334,20 @@ to
<%= f.file_field :picture %>
{% endhighlight %}

Sometimes, you might get an *TypeError: can't cast ActionDispatch::Http::UploadedFile to string*.

If this happens, in file `app/views/ideas/_form.html.erb` change the line

{% highlight erb %}
<%= form_for(@idea) do |f| %>
{% endhighlight %}

to

{% highlight erb %}
<%= form_for @idea, :html => {:multipart => true} do |f| %>
{% endhighlight %}

In your browser, add new idea with a picture. When you upload a picture it doesn't look nice because it only shows a path to the file, so let's fix that.

Open `app/views/ideas/show.html.erb` and change
Expand Down

0 comments on commit acaaffe

Please sign in to comment.