It's been about a year since we started working on the second major version of Faalis and finally we released v2 yesterday. This release introduce a complete set of new features something near a rewrite.
Let's take a look at changes in compare to previous versions.
Dashboard Interface & Turbolinks
- Handling two different application code base takes too much energy.
- Our assets got too big.
- We ended up with a giant JS application which was too slow.
- The damn "Angular World" which caused us lots of work and pain.
- JS application got complex and after a while debugging it was so hard
- And finally Turbolinks rocks.
The above reasons were enough to drive me crazy. In that time I suddenly remembered something important by watching @dhh keynote talk on RailsConf 2015. I was totally forgot about how awesome Turbolinks can be. In the past I was ignorant about Turbolinks simply because it was'nt that good at the time being.
After spending a little time to update my knowledge about Turbolinks, I get to work and created a very basic prototype of Faalis dashboard to see how can it be helpful to us. After a while it was clear to me as the blue sky that IT'S WHAT WE NEEDED.
It Faalis 2.x, we re-write dashboard subsystem entirely. Now:
- It's much smaller
- It's much faster
- It's easier to work with dashboard UI API
- Generate code for each resource reduced to minimum.
- Everything is in the same Rails application code base.
New dashboard feels great.
Dashboard Interface & AdminLTE
Good folks at almsaeedstudio create a very nice piece of UI for dashboard interfaces aka AdminLTE with free software license. It's beautiful and awesome and uses bootstrap which is pretty popular. So we decided to use AdminLTE instead of our UI interface.
At first we cloned the AdminLTE and made somechanges to use in Faalis but after a while we did the right thing and created a gem called admin_lte-rails (Don't ask about the name, it's awful I know, but it's history :wink:) which uses fantastic rails-assets.org to provide an automatic build and SCSS version of AdminLTE with RTL layout support ( which vanilla AdminLTE does not support). This way we can always be up2date and keep up with AdminLTE version.
The biggest change in Faalis 2.x is to removal of old generators. If you were a Faalis user back in the 0.x and 1.x
versions you remember that we used to have a set of very complex code generators. By giving them a
representing our resource they would generate huge amount of code for that resource to work with both of our Rails and
AngularJS. They were great and handy in their time but we come to realize that the easier way for developers is meta programming
and dynamic codes not some generated static code for each resource. So we removed all the acient history and started fresh.
In Faalis 2.x we have only two generator for generating resource code. The main one is
faalis:resource which takes the
resource name as an argument and generates a dashboard controller alongside with injecting corresponding routes into
All the dashboard controllers inherit indirectly from
Faalis::Dashboard::ApplicationController which provides handful set of
methods and an easy to use DSL for developers to enhance their resource workflow in dashboard. Basically you only have to take
care of translations related to your resource ( don't worry we have a solution for this too :P). Dashboard controllers works
with the related resource model. I mean they do their business by extracting necessary information from models. So no extra
large generated code base for each resource. This way using and modifying dashboard work flows get 'freakin' easy. Also the provided
Faalis::Dashboard::ApplicationController can be a big deal of help to you in order to enhance your work flow.
The second generator
faalis:resources, is just a shortcut for first one. It gets several resource names and generate them
Make sure to take a look at Faalis guides to get more info about generators.
CanCan is a great gem but was not what we are looking for. So we ditched it in favor of Pundit
which is fantastic and robust gem designed for flexible authorization. In Faalis 2.x in addition to the old
ownership permissions for each resource, developers can alter the pundit
authorize class of each resource base on their desire which gives Faalis a huge advantage on authorization system.
The most important thing to remember is the this new authorization system is backward compatible you only have to generate the pundit authorization class for your resource.
After ditching AngularJS, personally I was checking out different options we had to implement our forms. Among those I reviewed. Formtastic stood on top and we used it in new Faalis. Formtastic is really awesome and easy to use and extend which gives us a great opportunity to define our own input classes on demand.
We never released Faalis 1.x officially (as gem I mean, you can use it via github). That's because we done several mistakes which I pointed out some of them in this article. But it gives us a very clear vision about where we want to go in the future. And Faalis 2.x is the result of what we learn alongside the road to 1.x. Personally I found Faalis 2.x fascinating (:)) yeah because I wrote it). It's really handy and can help any developer save lots of his/her time during web development process.
At last I really love to know your opinions on Faalis and its pros/cons. I love to hear about your suggestions or criticisms. I hope you find it plausible.