Quite a complicated subject for a post.
Hope at least some of you have an idea about the topic of this post.
Activescaffold supports concept of an inline actionlink, which is basically just a list column as a hyperlink. Out of the box it is used for associations to have a one click path to associated records. Unfortunetly, it was nt supported for singular polymorphic associations and in one of my projects I was missing this feature. I had to implement a log feature using a database as store. Each log statement should include a reference to the source. source was a perfect candidate for a polymorphic association.
I just had to extend activescaffold to support singular polymorphic assocation inline actionlinks.
I ve prepared a simple example app including invoice and applog model for those of you who are interesting in trying out.
Setup Example Application
- Download: one_step_active_scaffold
- Download: polymorphici_blog.rb and rename it to model_setup.rb
- Execute following command: ruby one_step_activescaffold.rb polymorphic_app jquery
- cd polymorphic_app
- rails s
- http://localhost:3000/invoices
- Create new invoice with a log entry
- http://localhost:3000/app_logs
Aug 24, 2011 @ 19:54:33
I’m trying to add paperclip with Polymorphic Association. It doesn’t appear as though the Polymorphic association is being detected by Active Scaffold? When I add the model association to ActiveScaffold it gives a Template::Error (Could not find ImagesController or ImageController)
For Example:
class Image true
has_attached_file :image
end
class User :imageable
end
I don’t know if the best way would be to set these up as some type of nested or embedded scaffold instead?
Aug 25, 2011 @ 16:19:07
Do you have an Images Controller
Aug 25, 2011 @ 17:27:23
That appears to be exactly what I needed to do. I was making this way more complicated than it needed to be.
Thanks!