Sha256: d730c3d7a3b2ce5899a2d6bb0cd33fe057d4b84d9053571a89eb9dc171e91d00
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
= The Opal Model Generator (OMG) The goal of this project is to unobtrusively make javascript objects for each desired ActiveModel implementation in a rails project. These javascript objects will allow you to run the expecting fetching, deleting, and saving methods expected as if you were in a rails environment. This project isn't disimilar to Vienna (https://github.com/opal/vienna), but is trying out going a step further by not requiring the user to rewrite the objects. Long way to go with this project, but presently if you include the omgjs gem gem 'omgjs', :git => 'https://github.com/trevorgrayson/omgjs.git' and reference the required javascript files in your layout: Presuming you are using rails assets, you're going to want to add the following lines to your application.js file. //= require opal //= require active_record //= require omg otherwise you'll do the traditional linking in your public folder: <script type="text/javascript" src="/javascripts/opal.js"></script> <script type="text/javascript" src="/javascripts/active_record.js"></script> <script type="text/javascript" src="/javascripts/omg.js"></script> The first is Opal's required library. The second, active_record, is the equivilent of ActiveRecord::Base in rails, and will do all the heavy lifting for these objects. Lastly, omg, will have a list of all your ActiveModels in the app/models/ directory. You will rebuild this file in development everytime you refresh your browser. You should be able to immediately load a page and find your models under the "Opal" namespace: <script> Opal.YourModelName.find(1) Opal.YourModelName.find('all', {conditions: 'id > 2'}) </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omgjs-0.0.10 | README.rdoc |