Posts Views in Rails
Post
Cancel

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.

This post is licensed under CC BY 4.0 by the author.
Recent Update
Trending Tags

Trending Tags