For a has_and_belongs_to_many association there has to be a migration (but
there is no model!). Rails does not automatically create tables for you. If
you are still in development, just drop your database and migrate again:
rake db:migrate:reset

On Sat, Sep 22, 2012 at 12:06 PM, Fahim Patel <pafa...@gmail.com> wrote:

>
> Actually i have raise same question yesterday, but no buddy response .
> Today i raise new topic and u response..
> I will explain now
> I am using has_and_belong_to_many association . This association will
> create third table automatically as per my
> knowledge, and by chance i have deleted that table from mysql.
> Now i wish to get that table but as i know there is no migration file is
> created when we use this type of Association.
> And i dont want to create migration because than i am not following the
>  rails rules.
> And if i create migration than what is use of  has_and_belongs_**to_many
> association.
>
> Refer my Yesterday question for better explaintion...
> Hope u will understood now.
>
>
> I have two models cow and milkman.
> I am using has_and_belongs_to_many in both models .
> By mistake i have deleted cows_milkmans table from database.
>
> When i use  this command i am getting error
> a = Cow.last
> a.milkmans  #  when i fire this command then i am getting error that
> cows_milkmans table not exist
>
> As per my knowledge has_and_belongs_**to_many will create third table
> automatically , no migration is needed.
>
> How can get that table ?
>
> On Friday, September 21, 2012 4:49:58 PM UTC+5:30, Fahim Patel wrote:
>>
>> Hi all
>>
>> As we all know that rake db:test:prepare effects all the changes from
>> development database to test database.
>> But due to one mistake i wish to make development database same as my
>> test database.
>>
>> So how can i  get effects from test database to development database ?
>>
>>
>>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/_EK15DE3gEAJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to