0

I'm trying to learn how to upload a data file to an application by following the instructions http://bit.ly/JgJyV and http://bit.ly/LXZ44L.

After following the instructions and typing in the code I open my browser and go to the link below.

localhost URL on port 3000: .../upload/index

Routing Error No route matches [GET] "/upload/index" Try running rake routes for more information on available routes.

I update config/routes.rb with:

resources: upload

Revisit localhost URL on port 3000: .../upload/index

Unknown action The action 'show' could not be found for UploadController

Try localhost URL on port 3000: .../upload Works! I select a file and click the Upload button:

Routing Error No route matches [POST] "/assets"

rake routes returns: Steves-iMac:config steve$ rake routes upload_index GET /upload(.:format) upload#index

         POST   /upload(.:format)          upload#create

new_upload GET /upload/new(.:format) upload#new

edit_upload GET /upload/:id/edit(.:format) upload#edit

  upload GET    /upload/:id(.:format)      upload#show

         PUT    /upload/:id(.:format)      upload#update

         DELETE /upload/:id(.:format)      upload#destroy

Any ideas?

1
  • Can you post the model, view and controller code.? and cool that you dont use a Gem and develop things from scratch. Its when you get a great handle of things and customize them however you want. Commented Jun 3, 2012 at 9:59

1 Answer 1

-1

There are widely used ruby gems to do what you want to do: Paperclip and Carrierwave.
So, why reinvent the wheel?

Sign up to request clarification or add additional context in comments.

6 Comments

Because for a Rails beginner those options didn't seem any easier.
I beg to differ my friend, these gems are well documented and there are tons of tutorials online. Head on to railscasts.com for the most comprehensive rails tutorials.
Well I been searching online about uploading a file and there doesn't seem to be many example, possibly because people use Paperclip and Carrierwave. But how hard can it be to do it without these these gems. I've been reading online about defining resources in Rails apps too; I guess (hope) it will just click at some point.
just checked out the posted url, its too old with way to many deprecated methods. what version of rails do you use? did you use the exact same code?
The comments following the instructions I am following suggest the code does not work. I did tweak things very slightly, used form_tag for example. I am using Rails 3.2.5 which seems to have changed quite a bit since I first looked at Rails in 2009, with the Rails 2.0.x, with the book Simply Rails 2 by Patrick Lenz.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.