Rails is a great tool for building web applications, but it’s not the best at everything. Embrace the features built into your database. Learn how to use front-end frameworks. Seize the power of the application stack through AngularJS, Bootstrap, and PostgreSQL. When used together, these powerful and easy-to-use tools will open you to a new world of possibilities. In each chapter of this book, you’ll learn how these technologies can work together inside a Rails app to deliver well-performing applications that offer great user experiences.
Create a usable and attractive login form using Bootstrap’s styles, while ensuring the database table backing it is secure, using Postgres’ check constraints. You’ll see how creating an advanced Postgres index for a case-insensitive search can speed up your back-end—allowing you to create a highly dynamic user experience using AngularJS. You’ll create complex interfaces using Bootstrap’s grid, together with Angular’s form support, backed by a materialized view for caching within Postgres. You’ll get your front-end working with the Asset Pipeline, use Postgres’ features from migrations, and write unit tests for all of it. All of this within Rails.
You’ll gain the confidence to work at every level of the application stack, bringing the right solution to every problem.
Full-Stack Web Development Tips
by Dave Copeland
Embrace Your Database
Most SQL databases are packed with handy features, but Postgres has more than most. Accurately model your domain with sophisticated data types like JSON and Arrays, speed up your queries with complex indexes and materialized views, and keep your data consistent with powerful check constraints.
Use a CSS Framework
Hand-written CSS can be complex and unmanageable fast. A CSS framework can allow you to style your UI more quickly and efficiently by using pre-build classes. An all-inclusive framework like Bootstrap goes even farther by giving you the ability to create detailed components that look and feel great—quickly, easily, and with no CSS.
When your user interface calls for more dynamic, interactive elements, you don’t want to start from scratch. Even with JQuery, your front-end code can be messy and untestable. Using a framework like Angular, you can confidently test your code, while easily providing complex features and interactions without making a mess.
Solve the Problem in the Right Place
With the ability to be effective at all levels of the stack, you can see the entire problem at once, and solve it where it needs it. It could be adding an index to your query takes your view from sluggish to snappy. Or, you may need to use AJAX to grab results one at a time. When you’re comfortable up and down the stack, you’ll solve it the right way.
Ten Features of Your Stack You’re Not Using
by Dave Copeland
- Grid-based design with Bootstrap. When you think of a UI as a grid, creating it becomes a lot simpler.
- Promises instead of Callbacks in Angular. Write your front-end code imperatively and clearly, without callback soup.
- MVC on the client using Angular. Sometimes UI code is complex, and you want it distinct from your templates. Keep your front-end code organized.
- Test your front-end code with Teaspoon. By separating your front-end logic from your views, you can unit test it, and be confident it will work.
- Materialized Views in Postgres. Automatically cache de-normalized data right in your database. Get further without standing up new caching infrastructure.
- Indexes on derived values in Postgres. Create a database index on normalized or modified values. Make your indexes match your queries without any hacks.
- Store, query, and index JSON with Postgres. Don’t sacrifice performance if you have to deal with loosely defined data.
- Native arrays in Postgres. Sometimes you just need a list of strings without making a lot of new tables.
- Headless integration tests with PhantomJS. Run full-blown integration tests quickly from the command line, without launching an actual browser.
- Bring it all together with Rails. Despite being an opinionated framework, Rails has all the hooks you need to enhance your stack.
Read the reviews .