ROR-使用Paperclip逐步执行多个图像 [英] ROR- Step by step multiple images using Paperclip

查看:91
本文介绍了ROR-使用Paperclip逐步执行多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里但由于某种原因它不起作用。

I have used the "tutorial" on here but for some reason it didn't work.

任何人都可以给我一个设置多个图像表格的分步指南(上传)与其他表单元素...

Can anyone give me a step-by-step guide for setting up a multiple image form (upload) with other form elements ...

还可以提供另一个教程(一个好的教程)。

Also another tutorial (a good one) may be provided.

我只想使用回形针插件。

I only want to use the paperclip plugin.

@Gordon Isnor:
我上传了当前(noob)项目的一些功能(登录,注册) )
但它甚至没有微调。
我只是想让多个图像工作,所有多个图像的代码都会在此源中被删除。所以它干净利落。
(暂不注意当前登录;-))
Ps。使用默认的nifty_scaffold等...:)

@Gordon Isnor: I have uploaded my current (noob) project with some functionality (login, register) but it's not even fine tuned a little. I'm only trying to get the multiple images working, all code of the "multiple" images is deleted in this source. So it's clean and running. (don't notice the current login for now ;-)) Ps. Using the default's nifty_scaffold and etc... :)

仅限stackoverflow的眼睛:
Rapidshare link( - 100 kb。

For stackoverflow's eyes only: Rapidshare link (- 100 kb.

推荐答案

你有代码的例子吗?如果有什么东西要看,或者更详细地说明它是如何工作的,会更容易帮助。

Do you have examples of code? It would be easier to help if there was something to look at, or a more detailed description of how it’s not working.

Ok -

有些要点可以帮助您入门:

Some points to help you get started:

1 - 在您的Progress模型中,您接受的是嵌套属性不存在的模型:您需要带有Paperclip附件的ProgressImage模型:

1 - in your Progress model you are accepting nested attributes for a model that does not exist: you need a ProgressImage model with a Paperclip attachment:

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

2 - 你的进步表格不是多部分,它必须是:

2 - Your progress form is not multipart, it will needs to be:

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

3 - 您的进度表需要嵌套属性文件字段,有关于如何执行此操作的各种文章:

3 - Your progress form needs nested attribute file fields, there are various articles about how to do this:

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

4-还有一个我发现有用的插件对于嵌套属性表单,名为add_nested_fields: http://github.com/miletbaker/add_nested_fields

4- There’s also a plugin that I have found useful for nested attribute forms, called add_nested_fields: http://github.com/miletbaker/add_nested_fields

5 - 您有一个迁移将paperclip列添加到不存在的进度映像表中 - 您也可以更改该迁移以创建表,并包括那些特定于回形针的列然后你需要使用 rake db:migrate 来运行它。

5 - You have a migration to add paperclip columns to the non-existent progress images table - you might as well change that migration to create the table, and include those paperclip-specific columns and then you need to run it using rake db:migrate.

这篇关于ROR-使用Paperclip逐步执行多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆