Jan 17, 2008
Generic-user-small eddie may 5 posts

Topic: Advanced Rails Recipes / Suggestions for Recipes

Last one, I promise!

A clear explanation and example of the use of dynamic vs static scaffolding.

Thanks

 
Jan 17, 2008
Generic-user-small eddie may 5 posts

Topic: Advanced Rails Recipes / Suggestions for Recipes

Ok, this may be too ambitious for a recipe or even completely off topic, but here goes anyway!

Imagine a situation where you need to create an application for selling a multiplicity of different products – cars, motorbikes, paintings, antiques, etc, etc. Each product has different attributes – cars have a model and manufacturer, paintings have an artist & title. Similar (manufacturer = artist, model = title) but not the same!

One approach might be to have a ‘products’ table with common fields such as id, price & then generic such as field3, field4, field5, etc, etc. Then one could subclass the ‘Product’ class with a Picture class that would define what field3, field4 for this class are called (field3=Artist, field4 = Title, etc).

How would/could such a ‘dynamic’ approach work with rails? Most of the examples I’ve seen re: rails are relatively straightforward mappings between a ‘products’ table and a ‘Product’ class.

Thanks

 
Jan 16, 2008
Generic-user-small eddie may 5 posts

Topic: Advanced Rails Recipes / Suggestions for Recipes

One more thought!
While it’s good to see recipes about rails logging, I’ve not seen anything about dealing with web logs. Imagine an extension to your recipe on user subdomains, that logged//reported on page views and referrers (to & from) so that users could see how popular their subdomain was? Perhaps you could deal with the best strategies to employ – logging hits in the database or chomping thro’ any existing web server stats.

Thanks again.

 
Jan 16, 2008
Generic-user-small eddie may 5 posts

Topic: Advanced Rails Recipes / Suggestions for Recipes

I second (or third, fourth, ...) the admin UI recipe suggestion. I recently moved some controllers + views into an admin directory & had problems getting it to work until I added the admin ‘directive’ to the form in the view like so:
<% form_for([:admin,@dealer], :html => {:multipart => true }) do |f| %>.
I’m not sure if this is the way or a bad way.
Btw, after moving this stuff into my admin directory, I can’t get the image uploading recipe to work on these controllers!
It was not something that was easy to google.
Thanks

 
Jan 16, 2008
Generic-user-small eddie may 5 posts

Topic: Advanced Rails Recipes / Sugestion for Upload Chapter

Hi,
This is an excellent suggestion. While I’m at it, I would also like to see something about changing the image file name (with validates_uniqueness_of, perhaps by adding the cover_id to the end of the chosen image name), setting the file location for saving images, ....
Thanks

5 posts