On Thu, Apr 29, 2010 at 1:26 AM, Veena Jose <li...@ruby-forum.com> wrote:
> Hai Rick,
>
>   I have made the change you hav told. Still the join table is not been
> populated.
> These are my migration data.Is there any problem with this?
> .....................................................
> class CreateNewStations < ActiveRecord::Migration
>  def self.up
>    create_table :stations do |t|
>      t.string :name
>      t.integer :district_id
>      t.string :MDT_id
>      t.string :sim_no
>      t.decimal :longitude,  :precision=>10, :scale=>6
>      t.decimal :latitude,   :precision=>10, :scale=>6
>      t.integer :user_id

I don't think you want this field.  This would be there if you had

    class Stations < ActiverRecord::Base
        belongs_to :user
    end

but you indicated that each station could have many users, and each
user could have many stations, thus the habtm relations.
>      t.timestamps
>
>    end
>    create_table :stations_users, :id => false do |t|
>      t.integer :user_id
>      t.integer :station_id
>    end
>  end
>
>  def self.down
>   drop_table :stations_users rescue nil
>    drop_table :stations
>  end
> end
> ...........................................................
>
> class CreateUsers < ActiveRecord::Migration
>  def self.up
>    create_table :users do |t|
>      t.string :name
>      t.string :username
>      t.string :hashed_password
>      t.string :salt
>      t.string :status
>      t.string :phone
>      t.string :email
>      t.integer :station_id
>      t.timestamps
>    end
>  end
>
>  def self.down
>    drop_table :users
>  end
> end
>


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to