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

  1. Download: one_step_active_scaffold
  2. Download: polymorphici_blog.rb and rename it to model_setup.rb
  3. Execute following command: ruby one_step_activescaffold.rb polymorphic_app jquery
  4. cd polymorphic_app
  5. rails s
  6. http://localhost:3000/invoices
  7. Create new invoice with a log entry
  8. http://localhost:3000/app_logs
Advertisements