I''m trying to use file_column as a Rails plugin. Of course I read the doc (from Sebastian, this maillist) and little bit of source (as good as I, newbie, could understand it).. But I''m not able to implement it in my app.. I''m a totally newbie with less software development experience. I get the file_column_field in my view with simply invoking the helper... (:multipart => true). But what''s next? - Do I need to declare the instance methods in my model class? - What do I need to do with my controller, to get the process work? Maybe somebody could provide me a little example source of model, controller, view? Thank you.
Bob wrote:> I''m trying to use file_column as a Rails plugin. > Of course I read the doc (from Sebastian, this maillist) and little > bit of source (as good as I, newbie, could understand it).. > > But I''m not able to implement it in my app.. I''m a totally newbie with > less software development experience. > I get the file_column_field in my view with simply invoking the > helper... (:multipart => true). > > But what''s next? > - Do I need to declare the instance methods in my model class? > - What do I need to do with my controller, to get the process work?#Model: class A < ActiveRecord::Base file_column :file end #Controller: @a = A.find(:first) #View to upload file <%= file_column_field ''a'',''file'' %> #View to display file <%= url_for_file_column ''a'',''file'' %> `file` is the name of the model attribute that will save the filename. So in your SQL you need: `file` varchar(255) default NULL Of course you can choose another name. Jonathan -- Jonathan Weiss http://blog.innerewut.de
Can I use file_column with PostgreSql? Citeren Jonathan Weiss <jw@innerewut.de>:> Bob wrote: > > I''m trying to use file_column as a Rails plugin. > > Of course I read the doc (from Sebastian, this maillist) and > little > > bit of source (as good as I, newbie, could understand it).. > > > > But I''m not able to implement it in my app.. I''m a totally newbie > with > > less software development experience. > > I get the file_column_field in my view with simply invoking the > > helper... (:multipart => true). > > > > But what''s next? > > - Do I need to declare the instance methods in my model class? > > - What do I need to do with my controller, to get the process > work? > > #Model: > > class A < ActiveRecord::Base > file_column :file > end > > #Controller: > @a = A.find(:first) > > #View to upload file > <%= file_column_field ''a'',''file'' %> > > #View to display file > <%= url_for_file_column ''a'',''file'' %> > > > `file` is the name of the model attribute that will save the > filename. > So in your SQL you need: > > `file` varchar(255) default NULL > > Of course you can choose another name. > > Jonathan > > -- > Jonathan Weiss > http://blog.innerewut.de > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Bob wrote:> Can I use file_column with PostgreSql? >AFAIK yes as the file is stored on the filesystem and only the filename will be stored in the database. So you could use any of the supported databases. The actual file will be stored in public/MODELNAME/ID/FILENAME Jonathan -- Jonathan Weiss http://blog.innerewut.de