db----
   def self.up
    create_table :db_files,:force => true do |t|
      t.binary :data
      t.timestamps
    end
  end
db----

controller----
def find_db_file
    project=Project.find_by_id(params[:id])
    project_snapshot=project.project_snapshot
    send_data(project_snapshot.db_file.data,
                              :type  => project_snapshot.content_type,
                              :filename => project_snapshot.filename,
                              :disposition => 'inline')
end
controller----


view-------
 <%for p in @projects -%>
  <%=image_tag(url_for
(:controller=>:projects,:action=>:find_db_file,:id=>p.id))-%>
 <%end-%>
view-------



I try my best to display the image data in the database,but fail.It
seems everything is right.Even try from mysql to sqlite not works.This
really let me down.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to