Views in Rails

I had to create a view for a join table of a many-to-many relationship in my model. To do this, I had to have a database migration use the ‘execute’ command to create the view. Tests failed because the schema.rb dump file does not deal with views. To fix, I had to set the following in my environments.rb file.

ActiveRecord::Base.schema_format= :sql

Then everything worked. At that point, it was just fixing my tests.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s