# Scaffold with 1-M?

**URL:** <https://www.ruby-forum.com/t/scaffold-with-1-m/66376>\
**Category:** Rails\
**Created:** [August 25, 2006, 12:51am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376 "2006-08-25T00:51:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 25, 2006, 12:51am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/1 "2006-08-25T00:51:45Z")

</div>

So Iâ??ve been following streamlined  
([http://streamlined.relevancellc.com/](http://streamlined.relevancellc.com/)) and Ajax Scaffold for awhile and  
they look like great tools. However Iâ??m looking for a tool thatâ??s more  
like a scaffolding on steroids rather than an admin CRUD tool.

What Iâ??m looking for is a generator I can use to do rapid prototyping  
with a client (like scaffold) but that can at least handle 1-M stuff  
(has\_many, belongs\_to) etc. The resulting prototype â??enhanced scaffoldâ??  
can then be used as a starting place for the real app, so it has to be  
extremely spartan (like current scaffold). Does anyone know of a tool  
like this out there? Cheers.

---

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 25, 2006, 2:01am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/2 "2006-08-25T02:01:33Z")

</div>

On 8/24/06, inboulder [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> like this out there? Cheers.  
> Not sure if it will do everything you want, but you may want to look  
> at the Scaffolding Extensions plugin [1].

[1]  
[http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin](http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin)

---

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 25, 2006, 8:14am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/3 "2006-08-25T08:14:50Z")

</div>

Jeremy E. wrote:

> [1]  
> [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin)

Hi, I’ve taken a look at that b/f, but it appears to be a plugin and not  
a generator, so it’s not really a way of creating a bare bones app to  
build on top of. Am I correct in thinking this?

---

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 25, 2006, 10:02am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/4 "2006-08-25T10:02:16Z")

</div>

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](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](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](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

---

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 25, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/5 "2006-08-25T12:02:31Z")

</div>

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:  
\*

def product\_details  
begin  
Locale.set “es-ES”  
@product = Product.find(:all, :conditions =\> “id = #{params[:id]}  
AND #{@@active}”)  
@product = @product[0]  
…

And in this case Globalize returns the translated name. But why does it  
not return it when I use Product.find?

---

<div class="post-metadata">

**Author:** ![inboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@inboulder](https://www.ruby-forum.com/u/inboulder)\
**Post date:** [August 26, 2006, 11:36am UTC](https://www.ruby-forum.com/t/scaffold-with-1-m/66376/6 "2006-08-26T11:36:20Z")

</div>

On 8/24/06, inboulder [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > [1]  
> > [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin)
> 
> Hi, I’ve taken a look at that b/f, but it appears to be a plugin and not  
> a generator, so it’s not really a way of creating a bare bones app to  
> build on top of. Am I correct in thinking 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.
