Saturday, July 21, 2012

[Rails] Re: Attributes in classes db/migrate or app/models

Thank you for your answer Hassan,

I explain my problem. If I've got a Person class in my model, with
Rails I will have a class CreatePersons (for example) in db/migrate/
with its attributes (name, address, telephone...)

class CreatePersons< ActiveRecord::Migration
def change
create_table :persons do |t|
t.string :name
t.string :address
.....

t.timestamps
end
end
end



And I'll have the class Person in app/models, but in this class, I
mustn't put the attributes name, address...


class Persona < ActiveRecord::Base
end


If I work with the Person class, I will have a class without attributes
name or address!!

Is it right what I've told? Or, haven't I understood de idea in Rails?

Thanks!

--
Posted via http://www.ruby-forum.com/.

--
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 https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate