Hello, i am a C# programmer and i am looking in to ruby on rails. but i am having some trouble probably with the mind set or something.
I have an object Vote, that object can be Pro, Neutral or con.
I would normaly make the vote object have a field some thing like this
private VoteEnum voteEnum = VoteEnum.Neutral
how on earth can i acomplish this in ruby.
i have found some examples like:
def MyClass < ActiveRecord::Base
ACTIVE_STATUS = "active"
INACTIVE_STATUS = "inactive"
PENDING_STATUS = "pending"
end
Then, when using the model from another class, I reference the constants
@model.status = MyClass::ACTIVE_STATUS
@model.save
This seems correct to me but my main question is how do i tell the model that status is the type of enum or constain..
I hope you understand my question, and hope you can help me get my mind wrapped around this.