On Viernes, 24 de Septiembre de 2010 20:48:46 bantic escribió:
> Is it possible to customize the text that appears in a column that is
> a has_many association?
>
> For instance if I had a User#has_many :movies.  In my active_scaffold
> config I have a column "movies", and when the user has multiple movies
> they show up as a comma-separated list in that column that I can click
> on to view a nested form (subform? I forget the terminology) and edit/
> delete/show them.  But if the has doesn't have any movies there's just
> a dash "-" there that is hard to move my mouse to in order to click.
> I'd like it to be a longer string like "<Click to edit movies.>" or
> something like that.
>
> Is that possible through the configs?

You can change - to another string with config.list.empty_field_text

To change for each column you could use some helper method overrides:

# controller
config.columns[:association].options[:empty_text] = 'click to edit'

# controller helper
def format_value(column_value, options = {})
  if column_empty?(column_value) && options[:empty_text]
    clean_column_value(options[:empty_text]
  else
    super
  end
end

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

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