Rails: Two different layouts with two different CSS frameworks

Posted on Leave a comment

I have said it before. Rails is awesome. I find myself creating a new web application in Rails rather than, say, ASP.NET or even PHP much more often. It is intuitive and uncomplicated. Command-line tools and pre-handpicked components allow me to focus more on writing code and implementing business logic.

While working on a Rails application, I was faced with a (reasonably) common situation — having one layout for the end-users and another for administrators. I had my admin pages all written and finished. My CSS framework of choice at the time I started was Ink, mostly because of its fresh UX and Bootstrap‘s aging grid system. When I was about to start with end-user pages, I found out about the release of Bootstrap v4.0.0 (something I had been waiting for since long). The examples made using this version were very much in line with what I wanted for my own purpose. I had made a decision: use Bootstrap for end-user pages and stick to Ink for the admin interface. Realizing this decision in Rails was not as easy as I had thought.

As good as the Rails documentation is, I frequently find myself wanting for more code snippets and examples for things that are apparently presumed to be too basic to explain. After stackoverflowing into the problem and applying some common sense, I came up with the following solution.

Continue reading Rails: Two different layouts with two different CSS frameworks

Ruby and ES6

Posted on Leave a comment
puts "Hello, #{first_name}. What are you upto today?"
console.log (`Hello, ${firstName}. What are you upto today?`)

So, I am learning Ruby these days. You have heard of this book, haven’t you? Learn Ruby the Hard Way. Me? I found it only a few days back. It’s been a fun read so far. Give it a whirl, even if you are a ninja programmer.

And I am learning ES6 as well. Part of my motivation came from seeing the excitement of my students at Ofssam for learning ES6 (ECMAScript2015 for the standards Nazis). Here’s my learning resource – Using ES6 in Your Node.js Web Application.

Trying out Ruby on Rails

Posted on Leave a comment

I never imagined this day would come. I am finally trying to catch up with the RoR phenomenon. And I am at least 8-10 years late. Teaching enterprise software development made me appreciate a strict adherence to coding best practices even more. That’s where Rail’s philosophy got me interested, especially its Convention over Configuration doctrine.

What this means is I will have to learn Ruby first! I’ve heard a lot of “Ruby is a fun language”, “Ruby is perfect for beginners”, and what not. Coming from a Python background, I had personally never felt the need of checking out Ruby. I do not aspire to become a language ninja. Java, C#, JavaScript, Python and PHP are good enough for me. For me they serve different purposes and I love them all. Can Ruby become my latest muse? Let’s see in the next few days.

Right now I’m readying my Visual Studio Code to support RoR apps better. I found this cool extension for the purpose. Haven’t installed it yet, though.