Sorry; doesn't seem to help...

If I use type and not type_id in config.columns, then list/create/
update just display the id of the type record and it's a plain text
field, not a select box.

I don't understand what you mean by a "name" column, but I don't
believe a to_label is needed; I have config.columns[:type_id].label
for the type field (and it's working). I also have a config.list.label
definition (wasn't shown), and that's also working.

Yes, I know that the :foreign_key stuff isn't needed by Rails; I was
just trying that since AS isn't working as expected.

Thanks...

On Jun 10, 9:13 pm, Kerry Foley <[email protected]> wrote:
> config.columns uses type, not type_id
>
> Next, if you don't have a "name" column you'll need to define a to_label
> method.
>
> |class User < ActiveRecord::Base
>   def to_label
>     "User: #{username}"
>   end
> end
>
> And you can drop the foreign_key stuff. It's assumed to be type_id.
>
> Docs:http://wiki.github.com/activescaffold/active_scaffold
>
> Regards,
> Kerry
> |
>
> JSeidel wrote:
> > Hi... I have what I presumed to be a simple situation, but I haven't
> > been able to get it to work; I'm sure it's something I'm overlooking.
>
> > class Asset < ActiveRecord::Base
> >     belongs_to :type, :foreign_key => "type_id"
> > end
>
> > class Type < ActiveRecord::Base
> >   has_many :assets, :foreign_key => "type_id"
> > end
>
> > class AssetController < ApplicationController
> >   active_scaffold :asset do |config|
> >     config.columns = [:type_id, ..]
> >     config.columns[:type_id].label = "Item Type"
> >     config.columns[:type_id].form_ui = :select
> >     config.columns[:type_id].description = "The type of asset you are
> > creating."
> >     end
>
> > There are about 10 entries in type; I want to display the type name
> > (string) in the list view but it displays the type_id number. In the
> > Create and Edit views, it displays an empty select box.
>
> > This should be one of the easiest things to do in AS (I'm in the
> > process of upgrading from AjaxScaffold), but I sure can't figure it
> > out.
>
> > Any help is most appreciated.
>
> > Thanks...jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to