I'm coming from C#, and recently I started to write some Ruby on Rails applications.
My biggest problem with it is the documentation because I find it extremly difficult to use. For example, finding out how to call generator from my controller took me about 2 hours and then 15 minutes after that I found Rails::Generators.invoke method to figure out what arguments should I pass to this function.
Maybe I use the documentation the wrong way; First I take a wild guess and search in the Netbeans code completion, which is rarely helpful, then I search in Google, then go with the API.
Can some experienced Rails programmer give me some advice?
If you're new to rails I recommend you read a book before you dive into the API documentation.
Here are two recommendations:
Agile Web Development With Rails - Great introduction and reference on how to use rails.
Programming Ruby 1.9: The Pragmatic Programmers' Guide - More on Ruby. Great references!
After you've worked your way through those books, you'll have an idea of how Rails is designed and where to look for stuff.
Both books are great reference books. If you want to access the Rails and Ruby API's online, make sure to checkout RailsApi.com
I am describing my own very personal workflow with Ruby/Rails documentation:
You can use ri and rdoc if you are familiar with the console, but...
Personally, I recommend two very good Ruby/Rails documentation sites:
apidock.com (no good search, but sometimes fine examples)
railsapi.com (very good AJAX search, plus you can customize what documentation you would like to see - by versions and by Gems)
Every iteration of the Rails guides (http://guides.rubyonrails.org/) has a ton of useful stuff in it. That should be the first stop.
After that I search away in the API - http://api.rubyonrails.org.
Sometimes I even end up just reading the source code trying to find things - https://github.com/rails/rails.
I think the best place in the source code to be reading is in here - https://github.com/rails/rails/tree/master/railties/lib/rails.
I upvoted each of the other answers here.
Related
I am trying to learn ROR these days and have basic knowledge of ruby, but often working with rails, I get to the point where it seems as if I don't know a bit about ruby.
Just to explain the point, in rails we use has_many keyword. I did not learn any such thing when I was going through ruby tutorials but just came to know that it has something to do with meta-programming in ruby (I have no idea what is meta programming).
So I would like to know if there is any book/tutorial which explain all the points/syntax/concepts of ruby, which a newbie would see while programming in rails.
Thanks to "Jonas Elfström", in simple words, what I am looking for is to know "how Rails uses Ruby"
Thanks.
has_many isn't a keyword, it's simply a class method in the ActiveRecord::Associations module.
It's documented here and you can even view the source if you scroll down a bit.
Associations are a set of macro-like class methods for tying objects
together through foreign keys. They express relationships like
“Project has one Project Manager” or “Project belongs to a Portfolio”.
Each macro adds a number of methods to the class which are specialized
according to the collection or association symbol and the options
hash. It works much the same way as Ruby’s own attr* methods.
If you already know Ruby the Rails Guides could get you going but it might be easier to learn from one of the books listed at the documentation page or by watching a couple of screencasts.
For books about Ruby I've never seen such praise as what Eloquent Ruby gets.
There's a tutorial called Learn Ruby the Hard Way
(written by Rob Sobers of Fog Creek Software)
I tried lately this: http://pine.fm/LearnToProgram/ which helped me a lot because there are one or two concepts that had slipped. I started long ago with an arcane version of this.
I see a lot of people asking about Blog Engines, but most of the questions & answers are rather old. Or if they aren't old most of the projects are old. I'm wondering if anyone knows of any Blog Engines that currently support Rails 3.1 or are at least being actively developed to support Rails 3.1.
I would also be interested in seeing any sample applications or blog posts written for Rails 3.1 Blogs. I am going to be adding a blog to one of my websites, and would prefer to simply use a Rails Engine or sample code if there are any good ones out there. I hate reinventing the wheel. Looking for something simple, and not too opinionated so I can modify easily to suit my own needs.
you might want to check out Refinery http://refinerycms.com/engines
doesn't look like they are 3.1 yet, but probably soon
https://github.com/resolve/refinerycms-blog
Your best bet would probably be to use Typo.
Typo is currently using rails 3.0.9. Rails 3.1.0 is still a release candidate so I don't know of any blogging apps using it right now. If you must use rails 3.1.0 then you may have luck grabbing the gem for 3.1.0.rc4 (the newest version) and using typo anyway. Chances are everything will still work.
Hope this helps.
Perhaps Enki is a good fit, currently at Rails 3.0 but there is a github branch with Rails 3.1 support.
http://www.enkiblog.com/
Interestingly BrowserCMS was recently made to be a mountable engine: https://github.com/browsermedia/browsercms/commit/6098699fed2e3dbd65815ac3a5ce0dd6acc103d2
Seem to have a bit of time and experience behind them. More akin to Concrete5 with an inline front end / in context editing facility for users, which can be a real plus.
Im looking into this now and Im getting to conclusion that the best way to do this would be mounting a rack-app(like sinatra) into your rails app, there's various basic sinatra blogs in github to start or copy, not to mention this is fully customizable and I guess very light-weight.. engines will likely have dependencies and may also break when updating gems, a rack app won`t
I wasn't able to find any satisfying solution with engines
other stuff I found:
mounting a rails app inside a rails app: http://blog.dynamic50.com/2010/02/22/rails-3-0-mount-multiple-apps-as-engines/ feels a bit weird(heavy?), but you could mount a fully featured app like enki...
http://planscope.io/blog/2012/03/08/mounting-a-blog-within-a-rails-3-application/ this blogpost talks about using Toto, it seems pretty nice, easy and simple... but the project is not being maintained and it doesn't seem to be able to support a lot of features...
I dunno about using git to post, it makes it really simple but I dunno if I'd like having non-code stuff in my commits
Monologue https://github.com/jipiboily/monologue . From their web:
It is a barebone blog engine for Rails. It is built as a Rails engine and with a focus on keeping very few dependencies to ease it's use in your project. You can also use monologue-markdown which will replace the default editor with a simple Markdown editor.
Seems like pretty active development also.
I am an ASP.Net MVC / C# developer looking to get started with Ruby on Rails. Could you point me out to any books / tutorials which would help jump ships quickly.
I am familiar with MVC, Castle Active Record and jquery.
Thanks
Having just gone through this and looking for the best ways to learn ruby and rails I found the following most useful:
http://pragprog.com/titles/rails4/agile-web-development-with-rails (covers Rails 3)
I found this a good starting place to go through the basics of rails and while reading this I was able to follow along and build the application.
http://guides.rubyonrails.org/
Instead of building an application you get the vertical view of rails - i.e., sections to understand models, caching, views, layouts, etc. This is a great resource to follow along and read the sections you are dealing with.
http://www.railscasts.com
As you come across something you need to implement - e.g., many to many relationships this site provides some great examples and walkthroughs.
As a C# developer you may be slightly confused by Ruby. Here are the sites I recommend for learning Ruby:
http://www.fincher.org/tips/Languages/Ruby/
Although not formatted great - I found this one very useful to get the gist of Ruby syntax.
http://www.ruby-lang.org/en/documentation/quickstart/
Another great easy to follow tutorial
Lastly just try out some code.
Good luck!
I enjoyed Ruby on Rails for .NET Developers
How quick you can jump ships is really dependent on how fast you pick up the Ruby language and a new IDE. If you already know MVC and ActiveRecord you'll probably fly right along.
Heroku is really really really cool. Definitely try it out.
Welcome to the rails world :) !
Here is some links that may interest you :
There is a fun way to learn : railsforzombies.org
You can watch great screencast at : railscasts.com
You can find a free book here it is very complete : railstutorial.org/ruby-on-rails-tutorial-book
I also found this : www.digitalmediaminute.com/article/1816/top-ruby-on-rails-tutorials
There should be a lot more.
Have fun !
Ya right of now Ruby on Rails 3 is so proper among RoR developer. so get update on it.
Beginning Rails 3 - http://apress.com/book/view/9781430224334
Agile web development Rails 3 - http://pragprog.com/titles/rails4/agile-web-development-with-rails
These two books are rocking new learning and making a step on RoR.
and if u want video tutorial,
go for Railscasts and Teachmecode
What ruby based forum software would you recommend for integration into an existing rails application and allows single sign-on? I have seen many suggestions in posts for forum software that is no longer maintained (2008 and earlier).
Beast is the most current one I know of, and I'm sure it's the one you are referencing.
The rest is more of a side note, but, when I first got into rails, i asked similar questions, aka, what is the best blog, cms, forum, etc to use? As it turns out, the Rails community as a whole is interested in use cases that fit outside the plug-n-play web apps, so most people will end up rolling their own to fit their needs exactly if they find occasion to build such an app in Rails. The good news is that I think that I remember hearing that beast is like 800 lines of code, so it can't been too burdensome to either upgrade out of 2.2ish rails or just copy over the logic you need for your forum.
Thredded is very actively maintained!
Thredded is a Rails engine, so it is very easy to integrate it into an existing app.
http://github.com/radar/rboard
Rboard is really pretty awesome. :)
I always refer to Ruby Toolbox on what the rails comunity prefers.
Here's a good reference http://ruby-toolbox.com/categories/forum_systems.html
Based on the list there are two projects
Rboard - last commit 25 days ago
altered_beast - last commit 12 months ago
I agree with Jed Schneider, in the end most rails guys will roll out their own to fit the exact needs.
Forem and Discourse look promising:
https://github.com/radar/forem
https://github.com/discourse/discourse
Great ruby on rails examples of almost real world applications:
Can somebody give some links of sites that have such codes using the best practices in structure, implementing it, models, controllers, security, views, caching, modularizing and so on? thanks
You could start with guides.rubyonrails.org. They have a lot of information on there. A very good example to start with. Start with the Getting Started link. There are also a lot of other examples on that site.
The next step you might be better off buying a book on this subject. I purchased Simply Rails 2 by Patrick Lenz. Also a very good starter book with good examples. He walks you through an app that's similar to Digg. This will get you into the Model-View-Controller mind set.
If you want to go further, I would suggest Agile Web Development with Rails, Third Edition by Sam Ruby, Dave Thomas, David Heinemeier Hansson. I would suggest the PDF because I use it as a reference and searching within the 774 pages is helpful to say the least. This is my favorite but definitely not a starter book. It's broken into two halves. The first half is a tutorial on how to write a shopping cart. With this example you get into the database models, migrations, sessions, helpers, ajax, routes, security - shows you how to create your own authentication process and more. The second half of the book is more of a reference guide and goes into greater depth than the application tutorial.
From here I would look into plugins to help you out. Search on www.github.com. They host a lot of the open source plugins available. Don't go too wild on plugins because too many will defeat the principles of being RESTful. For security/authentication I would reccomend Authlogic. I still think it's beneficial to go through the tutorial on how to create your own authentication (from the Agile Web Development with Rails book) to see what actually goes into this plugin.
Lastly, but not the least bit important is to start thinking about how you will deploy your app. You may think this is trivial but the longer you put it off, the harder it will become. Look into capistrano and deprec gems (plugins) to deploy onto a VPS. I've had numerous problems deploying to a shared host.
Don't start with the most complicated part of rails like I did. Work from the guides first and get into more complicated apps. Rails has a pretty steep learning curve.
Hope this helps.
Found your post while I was looking for the same thing, this blog post was useful:
http://blog.chrislowis.co.uk/2010/05/31/five-rails-apps-to-study-and-learn-from.html
The Real World Rails repo brings 100+ (and growing) active, open source Rails apps together in one repository using git submodules.
You can clone the collected codebases and learn from Rails apps written by experienced developers. You’ll find all the codebases in the apps/ subdirectory.
Apps you'll find there include Discourse, Diaspora, GitLab, Hound, Rails Contributors, and the Ruby Gems web site.