Marius,
If I understand correctly what you''re trying to do, you want
something like this in your model:
def new_object_name
"#{object_nr} - #{object_name}"
end
Then in your controller:
@objects = Object.find(:all)
And in your view:
options_from_collection_for(@objects, ''id'',
''new_object_name'')
Cheers,
Pete Yandell
http://9cays.com/
On 29/05/2006, at 6:18 PM, Marius H?chler wrote:
> Hello,
>
> I have a problem with one of my Rails-Application, I have a table
> and on
> this there is object_name and a object_nr, so i want to create a
> combination of both in the model for a collection box.
>
> I''ve tried something like this:
>
>
> def set_new_object_name
> objects = find(:all).to_new_object_name
> end
>
> def self.to_new_object_name
> self.new_object_name = self.object_nr + " - " +
self.object_name
> end
>
>
> I don''t know what to do know, can somebody help me?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails