How to generate CSV files in Rails

Controller code :

View
your view will look like

4 Comments

  • on 16 Jul 2007 at 7:16 pm #

    how can we apply validation to image uploading file…

  • on 17 Jul 2007 at 5:38 pm #

    Hello Mr. verma

    What type of validation you want ?
    for type use
    validates_format_of :picture, :with => %r{\.(gif|jpg|png)$}i,
    :message => “must be a URL for a GIF, JPG, or PNG image”

    for size use
    validates_size_of :picture, :maximum =>

    If your problem is somthing else, let me know the problem
    or you can use file_column plugin

  • on 17 Jul 2007 at 6:23 pm #

    hai satish, thank for your fast replay
    i am using file_column plugin in my application, for uploading image file to database.when i am uploading the image file to database without any imagepath(i.e empty ) in the upload field its getting error as:
    undefined method `read’ for “”:String
    i want to display the validation message rather than displaying the error message, for my application.so what type of validations i have to apply to my image uploading please can u suggest any thing more….

  • on 17 Jul 2007 at 8:17 pm #

    dear

    file_column did not store file in database , it store its name only

    use

    {:controller=>”controller_name”, :action=>”action_name”}, :html => { :multipart => true } do |f| -%>

    look at html options include :multipart=>true

    hope this will definitely solve your problem

  • Leave a Reply