Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Where can I get started?

rails gettingstarted

  • Please log in to reply
2 replies to this topic

#1 xzy

xzy

    Passenger

  • Members
  • 1 posts

Posted 16 July 2014 - 07:38 AM

I have a question that, if you get a rails application, and that had already released online,

you have to familiar the sourcecode, and add some more features, which way is better to

get start to study that codes and make the modifications?

 

I have a way, but I think it was not a good way, because I get lost after reading codes many hours later,

firstly, I use `rake routes` to get all the routes, then choose one of the controller and action, then go to

the model, views, helpers...

 

how do you think about this way, and you have a better way you think?

thanks.



#2 blackjack94

blackjack94

    Passenger

  • Members
  • 1 posts

Posted 21 July 2014 - 12:29 PM

This is only my humble opinion as a newbie. As a confess, I've only read and adapt with Ryan Bates RailsCasts' site (due to its simplicity).

 

Prep 0: Try to list out all the main features of that app.

 

Prep 1: Add this code to your footer to get a sense of what's going on

<%= debug(params) if Rails.env.development? %> 

Prep 2: Check the schema.rb and Model simultaneously, draw class diagrams and try to get a sense of how they implement each features with those models.

 

 

After the preps, all you need to look for is how they implement the features in the list. Continue with your Model-note, this time you explore all of the Controllers and their details.

 

0nd: Pick the simplest not-discovered-yet feature. Find all views related to that feature, drawing connections (views are linked via what you clicked  :D, so note them down )

 

1st: After having such graph, look at the view where you think should be the initial point, explore all possible links from it

  • Try click a link to see where it goes. With the debug params code, you can see which Controller is in action + the parameters it receives
  • Go to that controller#action to see how it handles the parameters, get a sense of what it does (do not explore the Models invoked)
  • repeat this steps several times until this view is not explorable anymore, continue with the next important view and proceed until no more views left (in this feature)

2nd: After getting a sense of what each Controller do, explore it further (the actions, the model called and the rendered views)

  • remember to take notes
  • this time you explore the business logic in the Model with a more in-depth (after all, controller only tells the story)
  • only stop this iteration when you can get a full overview of how this feature work. I believe you should now have a graph of Controllers, their actions (with received parameters & goal) related to that specific feature.

3nd: Keep that graph as commit 1. Create a completely new commit 2 graph, repeat this step until for feature 2 and so on.

 

After all, arrange them in orders and you have something to review day by day.

This may take you a full day with no-coding, only drawing boring pictures but I believe it worth the time spent. Really need some opinions from the experts.

 

P/S: I wish people would capture their app structures (RMVC) + how them talk, before and after implementing a feature. :D So that others can get up and running instantly. I hate how those documents are written long and wordy  :angry:


Edited by blackjack94, 21 July 2014 - 12:35 PM.

  • Jamie likes this

#3 RubyOnTop

RubyOnTop

    Passenger

  • Members
  • 4 posts

Posted 29 August 2014 - 09:50 PM

The best way to really get started is to learn the Ruby Language. I tried just going through Rails tutorials at first and was completely lost when it came to creating my own apps for unique projects. :ph34r: best of luck!







Also tagged with one or more of these keywords: rails, gettingstarted

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users