Scaffold with 1-M?

Not sure if it will do everything you want, but you may want to look at the Scaffolding Extensions plugin [1].

[1] Peak Obsession

I recently installed and *I believe* properly configured the Globalize plugin. However, it seems to work in one view and not another.

I have two product views - one for a listing of multiple products and one for a listing of a single product's details. My base language is set in environment.rb as:

include Globalize Locale.set_base_language 'en-US' Locale.set 'en-US'

I have a controller called product. Here's the index method snippet (I'm setting the Locale explicitly to test it out):

  def index     Locale.set "es-ES"     @products = Product.find(:all, :order => "date_added", :conditions => @@active     ....

My product model looks like:

class Product < ActiveRecord::Base   ....   translates :name, :description   ....

In this case, Globalize works correctly and displays the Spanish names correctly as seen in screenshot: http://www.tmpforums.com/images/tam/listings.jpg

The product_details method looks like:

  def product_details     begin       Locale.set "es-ES"       @product = Product.find(params[:id], :conditions => @@active)      ....

However, no matter what I do, it always keeps displaying the English name in this view: http://www.tmpforums.com/images/tam/details.jpg

I took a look at the globalize_translations table and to the best of my knowledge it looks fine: http://www.tmpforums.com/images/table.jpg

I've checked the view template and I'm not changing the locale in the view at all. I've even tried setting the locale in the view template to "es-ES" and it STILL displays it as English. I have no idea what I'm doing wrong, but I suspect it's something subtle I'm missing. Would really appreciate any help with this. Thanks!

Best Regards,

Tamim

I just found something strange. I changed the following:

def product_details     begin       Locale.set "es-ES"       @product = Product.find(params[:id], :conditions => @@active)      ....

*TO THIS:

Yes. However, I recently commited some changes that allow you to generate controller code with it, and you've always been able to copy to scaffold views and modify them. Not a true generator, but one of the main advantages of the plugin is that it (is|should be) flexible enough that you don't need to modify the output.

The plugin handles belongs_to, has_many, and habtm associations, but it is more suited to do admin CRUD than to be a true scaffold (in spite of the name). That said, it includes features that make rich user accessible forms easy to build, if you don't mind reading the RDoc or looking at the code.