Hi! I am learning to use rails, and I want to use Fleximage plugin.
But I can''t see how nice it is, because I can''t make it work.
So, what i have..
model "account" with blob field "image_file_data",
account acts_as_fleximage.
I installed ImageMagic and RMagic, I use InstantRails 2.0.
Everything seems to work, before I try ry save record..
When i submit form, i get error:
"unable to open image `emp/CGI.2844.10'': No such file or
directory"
Thank you in advance!
here is the code:
(EDIT VIEW)
<% form_for(@account, :html => { :multipart => true }) do |f| %>
...
<p>
<b>Upload Image</b><br />
<%= f.file_field :image_file %><br />
or URL: <%= f.text_field :image_file_url %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
(CONTROLLER)
def update
params[:account][:city_id]= params[:city][:id]
@account = Account.find(params[:id])
respond_to do |format|
if @account.update_attributes(params[:account])
flash[:notice] = ''Account was successfully updated.''
format.html { redirect_to(@account) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @account.errors, :status =>
:unprocessable_entity }
end
end
end
error:
"unable to open image `emp/CGI.2844.10'': No such file or
directory"
...
vendor/plugins/fleximage/lib/fleximage/model.rb:224:in `read''
vendor/plugins/fleximage/lib/fleximage/model.rb:224:in `image_file=''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2117:in
`send''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2117:in
`attributes=''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2116:in
`each''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2116:in
`attributes=''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2033:in
`update_attributes''
...
Request
Parameters:
{"city"=>{"id"=>"1"},
"commit"=>"Update",
"account"=>{"birthday(2i)"=>"9",
"image_file"=>#<File:C:/WINDOWS/Temp/CGI.2844.10>,
"birthday(3i)"=>"17",
"image_file_url"=>"",
"name1"=>"adasd",
"name2"=>"asdasd",
"city_id"=>"1",
"name3"=>"asasd",
"birthday(1i)"=>"2008"},
"_method"=>"put",
"authenticity_token"=>"adf9d72796dc8b9adb3fe92fee5b06322ac44bfd",
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---