ROR - Step-by-Step Multiple Images Using Paperclip

I used the โ€œtutorialโ€ on here , but for some reason it didn't work.

Can someone give me a step-by-step guide on how to configure the form of multiple images (upload) with other form elements ...

Another tutorial (good) may also be provided.

I want to use the paperclip plugin.

@ Gordon Isnor: I uploaded my current (noob) project with some functionality (login, registration) but it was not even configured a bit. I am only trying to work with several images, all the code of "several" images is deleted in this source. So it is clean and working. (at the moment, do not pay attention to the current login ;-)) Ps. Using standard nifty_scaffold etc .... :)

For stacking streams only: Rapidshare link (- 100 kb.

+4
source share
1 answer

Do you have any sample code? It would be easier to help if there was something to see, or a more detailed description of how it does not work.

OK -

Some points to help you get started:

1 - in your Progress model, you accept nested attributes for a model that does not exist: you need a ProgressImage model with attachments to clip:

class ProgressImage < ActiveRecord::Base belongs_to :progress has_attached_file :photo end 

2 - Your form of progress is not composite, it should be:

 <% form_for @progress, :html => { :multipart => true } do |f| %> 

3 - for your form of the move, the nested fields of the attribute file are needed, there are various articles on how to do this:

http://weblog.rubyonrails.org/2009/1/26/nested-model-forms

4- Theres also a plugin that I found useful for nested attribute forms called add_nested_fields: http://github.com/miletbaker/add_nested_fields

5 - You have the transition to adding paperclip columns to a nonexistent progress image table โ€” you can also change this migration to create a table and include those paperclip dependent columns, and then you need to run it with rake db:migrate .

+7
source

Source: https://habr.com/ru/post/1301988/


All Articles