is there a way using the file_column plugin to enforce a certain content type based on regex (i.ie, /^image/) and/or filesize (150k) ? thanks adam
On 1/9/06, Adam Denenberg <straightflush@gmail.com> wrote:> is there a way using the file_column plugin to enforce a certain > content type based on regex (i.ie, /^image/) and/or filesize (150k) > ? > > thanks > adam > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk/lib/validations.rb -- Kyle Maxwell Chief Technologist E Factor Media // FN Interactive kyle@efactormedia.com 1-866-263-3261
thanks. now for an even dumber question. Isnt rails supposed to automatically load the vendor directory ? I installed file_column but i get a undefined method `file_column'' for #<#<Class:0x40847dc0>:0x40847aa0> when using it in the model cant seem to find where to "require" file_column if thats necessary. adam On 1/9/06, Kyle Maxwell <kyle@kylemaxwell.com> wrote:> On 1/9/06, Adam Denenberg <straightflush@gmail.com> wrote: > > is there a way using the file_column plugin to enforce a certain > > content type based on regex (i.ie, /^image/) and/or filesize (150k) > > ? > > > > thanks > > adam > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk/lib/validations.rb > > -- > Kyle Maxwell > Chief Technologist > E Factor Media // FN Interactive > kyle@efactormedia.com > 1-866-263-3261 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On 1/10/06, Adam Denenberg <straightflush@gmail.com> wrote:> thanks. now for an even dumber question. Isnt rails supposed to > automatically load the vendor directory ? I installed file_column > but i get a > > undefined method `file_column'' for #<#<Class:0x40847dc0>:0x40847aa0> > when using it in the model > > cant seem to find where to "require" file_column if thats necessary.file_column is designed as a plugin. This means you should just drop it into vendor/plugins/file-column or install it via ./script/plugin install \ http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk Hope this helps Sebastian
> file_column is designed as a plugin. This means you should just drop > it into vendor/plugins/file-column or install it via > > ./script/plugin install \ > http://opensvn.csie.org/rails_file_column/plugins/file_column/trunkI have this same problem. I''ve run the command and file_column is now sitting in my plugins folder. I tried restarting the webserver, but I still get this error: undefined method `file_column'' for HomeImagesController:Class ---- And my controller looks like this: class HomeImagesController < ApplicationController #model :home_images # does this matter? file_column :filename end Do I need to "require" the plugin anywhere? It looks like it doesn''t recognize that it exists. -- Posted via http://www.ruby-forum.com/.
Your file_column :filename should be in your Model, not your controller. class HomeImages < ActiveRecord::Base file_column :filename end Step 2 is to change your new and edit views to include :multipart => true, like this: <%= start_form_tag ({:action => ''create''}, :multipart => true) %> After that, edit your _form partial to have the helper called: <p><label for="home_images_filename">File</label><br/> <%= file_column_field("home_images", "filename") %></p> You also shouldn''t need to call out your model unless rails is choking on it. Enjoy! -J On Feb 13, 2006, at 6:59 PM, Brandon wrote:> >> file_column is designed as a plugin. This means you should just drop >> it into vendor/plugins/file-column or install it via >> >> ./script/plugin install \ >> http://opensvn.csie.org/rails_file_column/plugins/file_column/ >> trunk > > I have this same problem. I''ve run the command and file_column is now > sitting in my plugins folder. I tried restarting the webserver, but I > still get this error: > > undefined method `file_column'' for HomeImagesController:Class > ---- > > And my controller looks like this: > class HomeImagesController < ApplicationController > #model :home_images # does this matter? > file_column :filename > end > > Do I need to "require" the plugin anywhere? It looks like it doesn''t > recognize that it exists.-- John Athayde bobo@meticulous.com Meticulous | www.meticulous.com (work) Rotoscope | www.rotoscope.com (sound: rock band) Boboroshi & Kynz | www.boboroshiandkynz.com (sound: electronic) Personal Weblog | www.boboroshi.com (play) "Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety." - Benjamin Franklin (1706-1790) Reply of the Pennsylvania Assembly to the Governor November 11, 1755 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060214/3b89dff8/attachment.html