controller - RESTful Rails & encapsulating behaviour -
Background - I have a model, say a door, in which there is open or closed position. I explain the behavior of opening the door (and I also have a # level equivalent).
But what is the best way to disclose it in a fast way?
Things, Gordon
Div class = "post-text" itemprop = "text">
Anyone Not the best way that everyone will agree.
Some people will add two custom actions open
and close
for your controllers, which are related to the door
model Will call the methods.
Other people use the door to change the update
controller method, which also uses to store their open / closed state such as a boolean field off
. They can also argue that in addition to open
and off
methods with the off
attribute, and whatever with the assumptions and callbacks Should be implemented open
/ shutdown
is used to encapsulate.
My recommendation is not to worry too much about unconsciousness and always chooses the most practical method.
Comments
Post a Comment