[LRUG] Rails and DB Views

Roland Swingler roland.swingler at gmail.com
Fri Jan 17 04:10:16 PST 2014


This was many years ago, so I don't remember the details, but
ActiveWarehouse had a gem/project for dealing with Views. It allowed you to
create views in migrations - don't know what it did about schema.rb. This
may/may not be rails 3/4 compatible.

R


On Fri, Jan 17, 2014 at 11:32 AM, Olly Legg <ollylegg at gmail.com> wrote:

> I haven't used database views before, but I *think* you should switch to
> using a SQL schema, using `config.active_record.schema_format` (
> http://guides.rubyonrails.org/configuring.html#configuring-active-record)
> and you can then use ActiveRecord::Connection#execute to create & manage
> your views (
> http://guides.rubyonrails.org/migrations.html#when-helpers-aren-t-enough).
>
> It should Just Work™.
>
> On 17 Jan 2014, at 11:20, Ed James (Alt) <ed.james.spam at gmail.com> wrote:
>
>  Hi all
>
> Is anyone using db views in a Rails app? If so, maybe you can help.
>
> My issue lies more around the management of the views, rather than using
> them in the app. I’ve done this before in a previous project but I don’t
> have access to that codebase anymore and I can’t remember what the hell I
> did.
>
>    - How do you make ActiveRecord recognise the view and exclude it from
>    the schema.rb file?
>    - I seem to remember keeping the views as .sql files which were
>    executed after a migration (by enhancing the db:migrate task). Any
>    variations on this?
>
> The only gem I’ve managed to find is this one:
> https://github.com/railsware/db_structure_ext/tree/master/lib/db_structure_ext
> Seems very old though and this seems like something which doesn’t need a
> gem. I know we didn’t use one previously.
>
> Unfortunately using the word “view” in search criteria is not very useful
> ;)
>
> Thanks,
> Ed.
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140117/4b868c09/attachment.html>


More information about the Chat mailing list