Douglas Tan
2006-May-15 09:55 UTC
[Rails] Finding out the file attributes in FileColumn models
Is there a way to find out the attributes that have been passed to file_column in models? I''ve looked through the source and it seems that the file_column methods are generated at runtime but there''s actually no class or instance variable that hold the file attribute. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060515/d30fa61c/attachment.html
Douglas Tan
2006-May-16 08:52 UTC
[Rails] Re: Finding out the file attributes in FileColumn models
consider this itch scratched, spent 1.5 days trying to understand the Fixtures and the FileColumn module. Got it to work by extending the FileColumn module with a class variable that stores the attribute value passed to file_column. I wanted to have a way to know the file attribute as I needed a way to automatically create files for the fixtures which are for models with file_column attributes. Once I figured out how to retrieve the file attributes for each model, this became trivial to implement. On 5/15/06, Douglas Tan <bianster@gmail.com> wrote:> > Is there a way to find out the attributes that have been passed to > file_column in models? I''ve looked through the source and it seems that the > file_column methods are generated at runtime but there''s actually no class > or instance variable that hold the file attribute. >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060516/a5ac31f0/attachment.html
Heikki Ylönen
2006-May-16 18:53 UTC
[Rails] Re: Finding out the file attributes in FileColumn models
Douglas Tan wrote:> I wanted to have a way to know the file attribute as I needed a way to > automatically create files for the fixtures which are for models with > file_column attributes. Once I figured out how to retrieve the file > attributes for each model, this became trivial to implement.I run into same problem today when I was writing tests for model which uses file_column. Any change for sharing how you did the fixture file creation? -- Posted via http://www.ruby-forum.com/.
Douglas Tan
2006-May-17 03:11 UTC
[Rails] Re: Finding out the file attributes in FileColumn models
I''ll be posting an entry on my blog about this soon, so stay tuned? On 5/17/06, Heikki Yl?nen <heikki74@gmail.com> wrote:> > Douglas Tan wrote: > > I wanted to have a way to know the file attribute as I needed a way to > > automatically create files for the fixtures which are for models with > > file_column attributes. Once I figured out how to retrieve the file > > attributes for each model, this became trivial to implement. > > I run into same problem today when I was writing tests for model which > uses file_column. Any change for sharing how you did the fixture file > creation? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060517/eb9cc92e/attachment.html
Douglas Tan
2006-May-17 04:00 UTC
[Rails] Re: Finding out the file attributes in FileColumn models
here''s how I got automatic file creation for fixtures to work http://www.practicalguile.com/articles/ruby/rails/automatically-creating-files-for-file_column-models-in-fixtures/ On 5/17/06, Douglas Tan <bianster@gmail.com> wrote:> > I''ll be posting an entry on my blog about this soon, so stay tuned? > > > On 5/17/06, Heikki Yl?nen <heikki74@gmail.com > wrote: > > > > Douglas Tan wrote: > > > I wanted to have a way to know the file attribute as I needed a way to > > > > > automatically create files for the fixtures which are for models with > > > file_column attributes. Once I figured out how to retrieve the file > > > attributes for each model, this became trivial to implement. > > > > I run into same problem today when I was writing tests for model which > > uses file_column. Any change for sharing how you did the fixture file > > creation? > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060517/f458465e/attachment.html