and I save and the development.log shows expected...
Processing Admin::AdsController#create (for 127.0.0.1 at 2010-02-13
17:49:15) [POST]
Parameters: {"html"=>{"multipart"=>"true"}, "commit"=>" Save ",
"ad"=>{"salesprogram_id"=>"3", "pic_1"=>"DSC01760.JPG",
"active"=>"true"}, "action"=>"create", "authenticity_token"=>"-",
"controller"=>"admin/ads"}
But the SQL Insert for pic_1_file_name, pic_1_file_size,
pic_1_content_type and pic_1_updated_at are all NULL
and I've googled and flailed and googled and flailed but I cannot make
this work.
and I save and the development.log shows expected...
Processing Admin::AdsController#create (for 127.0.0.1 at 2010-02-13
17:49:15) [POST]
Parameters: {"html"=>{"multipart"=>"true"}, "commit"=>" Save ",
"ad"=>{"salesprogram_id"=>"3", "pic_1"=>"DSC01760.JPG",
"active"=>"true"}, "action"=>"create", "authenticity_token"=>"-",
"controller"=>"admin/ads"}
But the SQL Insert for pic_1_file_name, pic_1_file_size,
pic_1_content_type and pic_1_updated_at are all NULL
and I've googled and flailed and googled and flailed but I cannot make
this work.
Can anyone toss me a bone here?
Craig
Parameters: {"html"=>{"multipart"=>"true"}, "commit"=>" Save ",
"ad"=>{"salesprogram_id"=>"3", "pic_1"=>"DSC01760.JPG",
"active"=>"true"}, "action"=>"create", "authenticity_token"=>"-",
"controller"=>"admin/ads"} actually is not what you want to see in the params hash; the value at "pic_1" should be a File object...
:html isn't an option form_tag understands; use use :multipart => true
for your options hash.
Craig White wrote:
> seems pretty simple, my model...
>
> has_attached_file :pic_1, :styles => { :thumb => "120x90" },
> :url => "/:attachment/:id_:style.:extension",
> :path => ":rails_root/public/system/:attachment/:id_:style.:extension"
>
> my view...
>
> <% form_tag(:action => 'create', :html => { :multipart => true }) do -%>
> <label for="ad_pic_1">Image</label>
> <%= file_field 'ad', 'pic_1' %>
> <%= submit_tag ' Save ', :class => 'button' %>
>
> and I save and the development.log shows expected...
> Processing Admin::AdsController#create (for 127.0.0.1 at 2010-02-13
> 17:49:15) [POST]
> Parameters: {"html"=>{"multipart"=>"true"}, "commit"=>" Save ",
> "ad"=>{"salesprogram_id"=>"3", "pic_1"=>"DSC01760.JPG",
> "active"=>"true"}, "action"=>"create", "authenticity_token"=>"-",
> "controller"=>"admin/ads"}
>
> But the SQL Insert for pic_1_file_name, pic_1_file_size,
> pic_1_content_type and pic_1_updated_at are all NULL
>
> and I've googled and flailed and googled and flailed but I cannot make
> this work.
>
> Can anyone toss me a bone here?
>
> Craig
Parameters: {"html"=>{"multipart"=>"true"}, "commit"=>" Save ",
> "ad"=>{"salesprogram_id"=>"3", "pic_1"=>"DSC01760.JPG",
> "active"=>"true"}, "action"=>"create", "authenticity_token"=>"-",
> "controller"=>"admin/ads"} actually is not what you want to see in the params hash; the value at "pic_1" should be a File object...