On Oct 24, 1:02 pm, “Maurício Linhares” [email protected]
I can’t imagine a reason why these methods are class and not instance
methods, could you please explain a litle bit more about your idea,
your model and your controller and what do you really want with these
Hi Maurício. They’re class methods because they don’t rely upon an
instance of the Property model. They’re for finding properties that
match the search criteria submitted by the user.
Here’s how it works:
- A user browses to /neighbourhoods/1/map/ . A Google Map is
displayed, and properties within that neighbourhood are plotted on the
- There’s a form that allows the user to filter which properties are
plotted on the map. For example, they can filter based on the:
-number of bedrooms;
-number of bathrooms;
-min or max price;
- When the user submits the form, the “map_filter” neighbourhood
action is called, which uses Property#filtered_properties to determine
which properties match the user’s search criteria.
- Property#filtered_properties calls the #filtered_X class method
that corresponds to each form field value. When #filtered_properties
finishes processing each form field value, it checks to see if an
error occured, and returns an appropriate value (IE: either the error
messages, or the properties that match the search criteria).
I hope that explains things a bit more clearly. Cheers,