

Ask HN: What would I gain from using Rails over Codeigniter? - therustytracks

I have a few ideas I've been kicking around for a while and I'm having trouble deciding on backend technologies. The backend is going to need to handle authentication/registration, CRUD using mongodb, and have a restful architecture. Most of my experience lies in PHP and Codeigniter. I'd like to know if it's worth it to learn Ruby and Rails. If so, what benefits would I gain using Rails over Codeigniter?
======
1123581321
We use both Rails and CodeIgniter. Rails has a much more useful core and its
libraries are more robust and useful. That means you will be able to develop
more quickly. However, you will have to spend some time learning how it works
if you've no experience, and you will want to build your app the Rails way
which might mean some redesign (hopefully not too much.)

Here's what you should look into: auth: devise gem, crud: Rails defaults +
mongoid gem, rest: by default in Rails.

~~~
therustytracks
Awesome. I've been looking for a reason to start learning rails. I took a look
at devise when I was doing some research it looks awesome. Gems are so sweet.
Codeigniter has a package management system (sparks) but the modules aren't
that great or maintained. Thanks for your advice I'll definitely be looking
into Rails and the gems you mentioned.

------
orangethirty
Is it worth learning? Depends. Do you want to get gigs doing Rails? What
attracts you to it?

What benefits over CI does RoR have?

Right now, none. You dont know Rails, but you know CI. The time it takes you
to learn RoR and its use of "magic" might be better spent writing your
application and testing if there is demand for it.

Sure, RoR has a lot of "reusable code", but you don't hknow the framework. And
that will just kill your project.

Build your basic app with CI, and then translate it into something else. I
wouldnt stray away from PHP if you are proficient with it. You may try other
frameworks like Laravel, which is very nice and is more modern that CI. It is
also dead-easy to work with. You might also want to check out Python/Flask or
even Django, since they are a bit easier to work with than Rails. Im not
saying they are better, so put your pitchforks back in the barnyard.

~~~
therustytracks
There's no rush or urgency to build the app I have in mind. It's going to be a
learning experience. I'm just tired of using the same framework and php. I've
been doing quite a bit of node.js at work and it's pretty sweet. I just want
to branch out and try new languages / technologies. The app I have in mind
will be using phantomjs, possibly backbone for the frontend, and it looks like
I'll be learning RoR for the backend.

~~~
orangethirty
That changes everything. Go learn RoR then. It will be lots of fun. Boy, do I
envy you! Rails is definitely a joyful ride. Just don't listen to much to the
fanboys and their absurdly complicated solutions to simple problems. Good luck
and keep me posted. I'd love to hear about your progress.

~~~
therustytracks
I definitely will. This past weekend I took some time to go through a few
intro tutorials on nettuts. I'm blown away by the awesomeness of rails and how
easy it makes TDD.

------
jamierumbelow
Rails is a great, progressive framework and I've learnt a lot about
programming in general by taking the time to familiarise myself and work with
it. Rails makes it very easy to write thoughtful, elegant code. But that's not
to say that it's impossible or even difficult to do with CodeIgniter.

You can extend CodeIgniter's core classes very easily to provide a lot of the
same magic you'll find in Rails. There are a lot of ORMs similar to
ActiveRecord available, and a great MongoDB library written by Alex Bilbie
(<https://github.com/alexbilbie/codeigniter-mongodb-library>). I've created a
popular open source library that enables you to autoload views into layouts
like in Rails (<https://github.com/jamierumbelow/codeigniter-base-
controller>).

You can implement RESTful URLs simply and efficiently by customising the
_routes.php_ file yourself, or by using a route generation engine such as
Pigeon (<https://github.com/jamierumbelow/pigeon>). If you'd prefer a more
"full-stack" REST solution, you could use Phil Sturgeon's heinously popular
REST_Controller (<https://github.com/philsturgeon/codeigniter-restserver/>).

All the above links are drag-and-drop solutions and take moments to download,
configure and understand.

You will learn a lot about a whole different kind of writing applications when
you learn Rails. But the same is true for Python/Django, the same is true for
functional programming languages such as Clojure and the same is true for
Objective-C and the iPhone SDK.

CodeIgniter is incredibly flexible and that's probably exactly why you use it.
Taking a bit of time to interact with the community and see what gems are out
there will let you write much better CI code, and a lot of the time you'll
find you don't need or want Rails.

DISCLAIMER: I have written a book about writing better and more Rails-y code
with CodeIgniter called The CodeIgniter Handbook
(<https://efendibooks.com/codeigniter-handbook/vol-1>).

------
decadentcactus
I started with CI like you, and have recently move to Django/Python. I feel as
if Django completely blows CI out of the water when it comes to robustness,
community, features, extendability etc (and I'd assume Rails is the same).
Although I also probably just like Python better.

I'd say if it's a side project/more wishful success, go with Rails. At the
very least, you'll learn something new and improve your skills. If it's
something that absolutely needs to work now and is a bit more complex, use
your existing CI knowledge for now.

But at some point (perhaps now) I'd just bite the bullet and go with Rails (or
Django of course, but either would be a step up).

~~~
therustytracks
I definitely think I'm going to go for Rails. I've heard a lot of great things
about Django as well. One of my coworkers swears by it. Thanks for the advice.

------
therustytracks
I've noticed over the past few weeks when I've been doing my research a lot of
large scale applications use RoR. I haven't been able to find any applications
that were built on Codeigniter that come close to the robustness of the apps
using rails.

~~~
e12e
I think part of that is that CodeIgniter has much less exposure and mind-share
than rails does.

Personally I've given up on php because they keep having horrible problems
with the core (c) code in the stack (not all of which are unique to php, like
image processing libraries) -- but I don't think it fair to write off
CodeIgniter as an alternative in general.

For anyone looking for a semi-large code-base using CI, I recommend having a
look at Bamboo Invoice:

<http://bambooinvoice.org/>

That said I would have been very happy to see more of Expression Engine
published under an open licence as well:

<http://expressionengine.com/>

My impression is that some of the projects that might have built larger stacks
on top of CI just go (or went) with EE rather than write the code themselves.

~~~
therustytracks
Codeigniter was the first php framework I learned. It was really easy to
understand and extend. However it just doesn't feel right and I'm starting to
think I'm just tired of php. I've seen bamboo invoice before. There are a few
other robust projects I've seen but nothing that you could compare to
37signals apps or github.

~~~
gh0zt
I also started using CodeIgniter and i also had, at some point , the feeling
that it "just doesn't feel right". If you want to learn a new language i'd
probably go with RoR otherwise take your existing PHP skills and use Symfony 2
(<http://symfony.com/>). It definitly has a steeper learning curve than
CodeIgniter but i couldn't think of a single point why i would prefer
CodeIgniter over Symfony 2 now.

