- The app variable is no longer global, but accessible via compound.app . Make sure to change all your files that reference app directly
- The same goes for models. They are now accessible via compound.models. . This also applies to model relations, for example: model.hasMany(compound.models.anotherModel);
- The following files, autogenerated by railwayjs, should be regeneraterd or rewritten since they changed
- server.js
- config/environment.js, config/environments/*, and config/initializers (see below)
- app/models/* (see below)
- config/initializers/db-tools.js
- views using
formTag
andformFor
(see below)
now should export function
module.exports = function (compound) {
var app = compound.app;
var User = compound.models.User;
// rest of file goes here
};
now should export function
module.exports = function (compound, ModelName) {
ModelName.validatesPresenceOf(...);
ModelName.prototype.method = function () {
};
};
As mentioned before, remember the new way to reference other models:
module.exports = function (compound, ModelName) {
ModelName.hasMany(compound.models.anotherModelName, {as: anotherMode});
};
-
Avoid using
formTag
andformFor
with blocks, new syntax:<% var form = formFor(resource) %> <%- form.begin() %> <%- form.input('propertyname') %> <%- form.submit() %> <%- form.end() %>
-
Use include instead of partial:
<%- partial('post/form', {form: form, resource: resource}) %> becomes <%- include '_form' %>
In newest CompoundJS version PUT and DELETE methods also protected from CSRF,
so you need to obtain latest javascripts/rails.js
from compoundjs (generate new project and copy to existing one).
This is replacement for npmfile. File should export function which return array of extensions:
module.exports = function (compound) {
return [
require('jugglingdb'),
require('ejs-ext'),
require('seedjs')
]
};
Compound protects PUT and DELETE requests from request forgery, so you need to update old public/javascripts/rails.js file to get working ajax requests.
fix this file, request pull