Monday, July 9, 2012

Re: [Rails] Controller Models

On 9 July 2012 20:13, Jean-Sébastien D. <lists@ruby-forum.com> wrote:
> Here I Just started to learn Ruby on Rails! My issues is when reading
> the data using my controller pages.
>
> I initiate my controller using this command
>
> rails g controller schoolTypes
>
> I then initiate my model has the following command
>
> rails g model schoolType
>
> Once this is done i then modify has follow the following pages
>
> create_school_type
> class CreateSchoolTypes < ActiveRecord::Migration
> def change
> create_table :school_types do |t|
> t.integer :schoolTypeID

You don't need this as an id field will automatically be added. Also
life will be simpler if you stick to the rails conventions for naming
things (don't use camelCase), if you needed a school type id it should
be called school_type_id.

I suggest you work right through some tutorials on RoR in order to get
the basic principles. railstutorial.org is good and is free to use
online (how many times have I typed that in the last year I wonder, my
fingers type it without conscious brain involvement). Also have a
look at the Rails Guides, starting with Getting Started, obviously.

Colin

--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate