[Rails] Re: how do i define and access custom function in model
class User < ActiveRecord::Base
def self.count_remade_users
end
end
My guess is that you are missing the "self" part of the method
declaration, which tells ruby that this is a class method.
On May 12, 7:59 am, nirosh <kunalan.kand...@gmail.com> wrote:
> i need to define a custom finction in model which is named as
> "count_remaked_users".
> when i try to access that function from view (<
> %=User.count_remaked_users%>) i'm getting "undefined method" error.
>
> any clue for this?.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home