methods in models dont work for views?

This question is more towards understanding how things work rather than
trying to just get something to work.

I have something like this in my user model.

def full_name
   first_name + " " + last_name
end

This works find if I use it for display values in a
collection_for_select.

options_from_collection_for_select( @users, :id, :full_name)

that probably uses send to call the method (which doesn't care about private methods)

It displays the full name in the selection box options.

But if I try to go <%=h @user.full_name %> I get an error saying

"private method `full_name' called for <...>"

Can I ask the obvious question: is the full_name method private?

Fred

No, you need to look at Fred’s question. That method is simply an
attribute method and should not be protected or private. If it is not,
it should work fine anywhere your object exists.

-Bill

Tom Norian wrote:

No problem, you aren’t wasting my time. We all overlook things from
time to time. As far as where to put this, you are correct. Anything
that changes the interface of the model class should go into the model,
or a module if it’s going to be mixed in to multiple models.

-Bill

Tom Norian wrote: