Displaying 3 results from an estimated 3 matches for "new_attach".
Did you mean:
netattach
2011 Aug 31
5
3.1rc8 - posting files in a test no longer works
A previously working test, that posted a file object no longer works
in the latest 3.1. The test looks like this:
params[:media][:new_attachment] = File.open("#{Rails.root}/test/data/
less_than_100.png")
post :create, params
In the controller, I obviously expect params[:media][:new_attachment]
to be a File object - and it used to be. Now it looks like #inspect
has been called on the file. Debugging out in the test:
(rdb:1)...
2007 Sep 18
2
Making attachment_fu polymorphic
...ts'')
## 5. Install the attachment_fu plugin and double check to make sure
things are set up right.
##
## To use Attachment_kung,
## 1. In your controller, get a Model with Attachment_kung mixed in
from the database
## (@p = Product.find(1), we''ll say)
## 2. Call the new_attachment method and pass it the params with the
uploaded_data. The line
## should look something like this: @attachment =
@p.new_attachment(params[:attachment])
## 3. Attachments, before they are saved, have a class name of
#{CallingClass}_attachment
## (ie if a Product calls new_attachment...
2007 Jul 19
3
Merb::Controller#url Usage
...ticles/:article_id/article_attachments/:id/edit
--path after: /articles/1/article_attachments/1/edit
=> "/articles/1/article_attachments/1/edit"
However, when having a new form on the page, I typically create the
new action with an empty instance of that model.
irb(main):006:0> new_attachment = article.article_attachments.new
=> #<ArticleAttachment:0x3406e94 @attributes={"content_type"=>nil,
"updated_at"=>nil, "public"=>true, "filename"=>nil, "article_id"=>nil,
"position"=>nil, "created_at"...