Hi,
I''m trying to code something that requires UI translation. I picked up
Gibberish plugin, which (unfortunately) expands the String class in
order to implement it''s magic. That seems to conflict with
attachment_fu. I''ve run the NetBeans debugger and stepped through the
creation of my Image record and it seems that file name is set to nul
at some point after gibberish extension code has ben run.
The code for the New Image form looks like this:
------------------------------------------
<% form_for(image, :html => { :multipart => true } ) do |f| -%>
<p>
<label for=''image_name''>
<%= "name"[:image_name] %>
</label><br />
<%= f.text_field :name %>
</p>
<p>
<label for=''image_name''>
<%= "image file"[:image_file] %>
</label><br />
<%= f.file_field :uploaded_data %>
</p>
<%= render :partial => ''common/meta_form'', :locals
=> { :item =>
image } %>
<p>
<%= f.submit button_name %>
</p>
<% end -%>
------------------------------------------
The create method in ImagesController is the default:
------------------------------------------
def create
@image = Image.new(params[:image])
respond_to do |format|
if @image.save
flash[:notice] = ''Image was successfully created.''
format.html { redirect_to(@image) }
format.xml { render :xml => @image, :status
=> :created, :location => @image }
else
format.html { render :action => "new" }
format.xml { render :xml => @image.errors, :status
=> :unprocessable_entity }
end
end
end
------------------------------------------
And the model contains attachment_fu code:
------------------------------------------
has_attachment :content_type => :image,
:storage => :file_system,
:path_prefix => ''public/assets/photos'',
:thumbnails => { :preview =>
''320x320>'', :thumb =>
''100x100>'' }
validates_as_attachment
------------------------------------------
Finally, the schema for the images table looks like this:
------------------------------------------
create_table "images", :force => true do |t|
t.string "filename"
t.integer "size"
t.integer "parent_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "content_type"
t.integer "height"
t.integer "width"
t.string "thumbnail"
end
------------------------------------------
Unfortunatly, my skills in both Ruby and Rails are fairly
underdeveloped so I can''t know for sure what is going on. Has anyone
been using Gibberish plugin in conjunction with attachment_fu? Can
anyone tell me how to make this work?
Alternatively, is there any other lightweight UI translation solution
that doesn''t involve modifying the String class?
Thanks in advance.
Branko
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---