Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Thomas Slater
5,094 PointsCode challenge: Paperclip Migrations
I've read through the documentation, which is pretty straightforward, and entered in what I thought was the right code (or it appears to make sense). But it still doesn't pass.
class CreateDocuments < ActiveRecord::Migration
def change
create_table(:documents) do |t|
t.integer :user_id
end
add_attachment :documents, :asset
end
end
is "add_attachment :documents, :asset" not the right line?
5 Answers

Robert Strohmeyer
6,081 PointsThe line you're looking for is:
add_attachment :documents, :attachment

Thomas Slater
5,094 PointsI'm getting an error when I try to upload a file:
"Document model missing required attr_accessor for 'attachment_file_name'"
so I downloaded the project files to check to see what's wrong, and so many of the files look way different than after the second course. Am I supposed to just copy these over? I suppose I know what they do, but I don't understand why so much was done to edit the code between the second fails course and this one.

Patrick Gellar
3,365 Pointswhat is the right line? I still haven't been able to get through with all my intuitions failing me.
yeah it's confusing.

Thomas Slater
5,094 PointsOh, it's covered in the next video. Including installing paperclip. I think the quiz should probably be after the following video, which is "attaching files", rather than directly after "installing paperclip" which doesn't install paperclip at all (though to be fair it's in the notes).

Thomas Slater
5,094 PointsThe right line for the quiz? Oh, he covers it in the next video. The quiz is, I think, in the wrong place.