Hi Johnny,
related to your original issue I have made a fix to it on
https://github.com/rafaelfranca/rails/commit/c0a07afa0185b7983fce66604f5883e3d7e03e60.
The commit message explain the problem.
About you question, if you change the schema.rb file that attribute should
be accesible to you in the tests.
Rafael Mendonça França
http://twitter.com/rafaelfranca
https://github.com/rafaelfranca
On Mon, Apr 22, 2013 at 3:49 PM, Johnny Holton
<johnnyholton@gmail.com>wrote:
> I submitted a PR for Rails. The bug I''m trying to fix occurs when
there
> is a unique field index on a table.
>
> In the test I wrote, I added the index, ran test code and removed the
> index all inside the test.
> This fails against mysql and mysql2 because they do not allow DDL
> statements in transactions.
>
> So now I''m trying to figure out my next steps.
>
> What is the preferred steps to take in regards to the Rails testing suite
> schema/models?
> Here are some options:
>
> - Add unique index to existing table field (assuming it doesn''t
break
> existing tests)
> - Create a new field on an existing table and add an index for that
> - Create new model/table and wire up the associations
> - Something else?
>
>
> Related, I''ve been playing around with a few of these and am
having
> trouble adding a column to a table.
> I changed the schema for ''Parrot'' table to add a
''nick'' column:
>
> ...
> t.column :nick, :string
> ...
> add_index :parrots, :nick, :unique => true
>
> But then when I run my test:
> ARCONN=mysql2 bundle exec ruby -I test
> test/cases/autosave_association_test.rb -n
>
test_should_save_new_record_that_has_same_value_as_existing_record_marked_for_destruction_on_field_that_has_unique_index
>
> I get ActiveRecord::UnknownAttributeError: unknown attribute: nick
>
> What do I have to do to have these changes reflected in the db?
>
> I tried:
> bundle exec rake mysql:drop_databases
> bundle exec rake mysql:build_databases
>
> but got the same error.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-core+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
> 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: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.