where to define a rails view table and instead a mysql table is created -


i using ror3.2 , have bunch of model objects now. 1 thing i'd have mysql view i'm not sure put it.

class createqv < activerecord::migration   def      execute <<-sql       drop view qv     sql      execute <<-sql2 #abbreviated view  create view qv select locations.name val locations (locations.is_enabled = 1) union select concat(menu_items.header,' ',menu_items.detail) val menu_items (menu_items.is_enabled = 1)     sql2   end end 

and update via

rake db:reset 

but creates table , i'm not sure why. proper way of creating view? if yes, why table created?

thx

afaik that's right behavior view, create pseudo table, gets updated every time update associated tables. question me is: why create view rails app? reason create view i'm aware of, deny users full access data. in rails app, control show whom , can change.

i might wrong though i'm not familiar relational databases.

edit: can test whether view works creating new location , looking in view


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -