Loop of Properties

I’m starting in RoR, sorry if this question seems too basic.

See the code below. The second parameter of the method Rails3AMF:
IntermediateModel.new must pass ALL properties “field”. How do I
implement a loop that does this?

Thanks,

Saulo


class User
include Mongoid::Document
include ActiveRecord::Serialization

field :name, :type => String
field :email, :type => String
field :username, :type => String
field :password, :type => String

def to_amf options=nil
Rails3AMF::IntermediateModel.new(self, {“name” => self[:name],
“email” => self[:email], … } )
end

end

Saulo Brust wrote:

I’m starting in RoR, sorry if this question seems too basic.

See the code below. The second parameter of the method Rails3AMF:
IntermediateModel.new must pass ALL properties “field”. How do I
implement a loop that does this?

Thanks,

Saulo


class User
include Mongoid::Document
include ActiveRecord::Serialization

field :name, :type => String
field :email, :type => String
field :username, :type => String
field :password, :type => String

def to_amf options=nil
Rails3AMF::IntermediateModel.new(self, {“name” => self[:name],
“email” => self[:email], … } )
end

Can’t you just use Rails’ validations for this? Am I missing something?

end

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs