Closed asgeo1 closed 10 years ago
Your only solution in to have a third column which is a concatenation of first_name
and last_name
. Just add a before_save
where you concatenate first_name
and last_name
and assign the result to this field.
OK thanks. I've done that now - not ideal, but not a big issue to implement.
In my 'student' model, I have separate
first_name
andlast_name
attributes. I have a methodname
on the model class which returns the full nameI want to use this
name
method in a wice_grid filter. Can I do that? I can display thename
method in a column easy enough by just passing it in a block. But I want to filter on this method as well.The problem is wice_grid looks at the underlying database structure, rather than the ActiveRecord model.
I thought of this:
I.e.
||
is the concatenation operator in PostgreSQL.That unfortunately doesn't work because wice_grid complains that
WiceGrid: Column 'first_name||last_name' is not found in table 'contact_informations'!
So I'm not sure what else to do. I don't want to have separate first_name and last_name columns in my grid - if I can filter them together into one column that would be awesome.
Any ideas?