compound-railway-changelog - RailwayJS History
require, publish method deprecated, use module.exports insteadimport and export methods from controller scopecsrf_tag to create the hidden input tag, thanks to fsateleras option), now it affects helper names too, via fsatelerAllow to collect information about response handling, db queries, etc.. Now we can build our own newrelic, with blackjack and hookers!
Updated generators, helpers and ejs-ext module. Many thanks to Garret Johnson
Extend helpers API prototype object:
railway.helpers.HelperSet.prototype.myCoolHelper = function () {
return '<p>Application-wide helper</p>'; // use this in your plugins
};
to get <%- myCoolHelper %> availabe in every view
Generate your application with --stylus option to work with stylus out-of-box:
/app/assets/styles/*.stylGET /styles/*.cssapp.set 'view options', layout : falseImportant change! Now resourceful form helpers generates input names within csope:
form_for(post, function (f)
f.input('title')
});
Will generate <input name="Post[title]" /> instead of <input name="title" />
For all existing code this behavior is not turned on to not break anything,
but for newly generated apps it turned on in config/environment file
app.set 'view options', complexNames: true
CRUD generator also rewritten to match new structure
Major amends:
memoryMinor improvements:
Bugfixes:
rw sA lot of changes in core, fully rewritten controllers flow, node 0.6.0 compatible
Migration notes:
publish method, not export (not allowed in node 0.6.0).db/schema [issue #63]New features:
ensure mongo and redis servers are running, then run
nodeunit test/generators.coffee
or
npm test
Check out autogenerated tests for controllers, additional nodeunit stubs can be used:
test.redirect '/path'
test.render 'viewName'
test.send 'what'
test.success() # check status 200
test.assign 'memberName'
More stubs coming soon
Now form labels can be localized automatically, just use it as previously:
<% form_for(user, {}, function (form) { %>
<%- form.label('name') %>
<% }); %>
And add translation to locales/en.yml:
en:
models:
User:
fields:
name: User name
email: Email address
Application can be generated with --tpl key, for now possibly values are
This list can be extended. Check out packages npm ejs-ext and jade-ext
if you need to learn how to do it. It easy: just add another lang-ext package
and install it before running railway g app --tpl lang
sudo npm link after railway init)Small improvements:
log/ENV.logObserver is a kind of controller, that listen for some event in the system, for example: paypal, twitter or facebook observers listens for callback from foreign service. Email observer may listen some events related to emails.
If you need app.on('someEvent') you should place this code in
APPROOT/app/observers/NAME_observer.js
Just place your key and cert into config directory, railway will use it.
Default names for keys are tsl.key and tsl.cert, but you can store in in another place, in that case just pass filenames to createServer function:
server.js
require('railway').createServer({key: '/tmp/key.pem', cert: '/tmp/cert.pem'});
config/locales/*.ymlapp.disable('model cache'); and app.disable('eval cache');Scaffold generator railway generate scaffold ModelName field1:type1 field2:type2
It generates model, crud controller and appropriated views
Now you can run railway init blog and railway will create directory structure
within blog root folder
By default will created file config/database.json that will force you to use
mongoose driver, feel free to modify it and use redis or mysql (both supported)
Also, running express -t ejs no longer required
Mongoose driver support
Describe your schema in db/schema.js, it's just commonjs module which should export
models. For describing logic please use app/models/*.js files. Every model
described in schema accessible as global object in all models and controllers.
Added features generator for cucumis. Run railway generate features, then
you will be able to create features using Gherkin language, parsed by kyuri.
form_for helperapp/views/layouts