Contributing to Ruby on Rails

for Beginners Like Me

Guo Xiang

@tgxworld

I put on braces a month ago

I start to speak really fast when I'm nervous

This is a slightly technical talk.

I'm just going to show code and not explain them :)

My experience as a Google Summer of Code Student

I didn't get the project I was working on.

But I was offered to work on another project and picked "Unifying Controller and Integration Tests"

I want to make Rails better so that more people can have jobs using Ruby - 'Aaron Patterson'

Reading Rails forces you to learn.

Or rather reading open source code in general

Rails is such a large code base, how can I contribute anything?

[CI SKIP] Doc Fix.

Improve performance!

Tools to help you understand the code base

ruby-prof

class UserFlowTest < ActionDispatch::IntegrationTest
  def test_index
    RubyProf.start
    get '/users'
    result = RubyProf.stop
    File.open "a.html", 'w' do |file|
      RubyProf::GraphHtmlPrinter.new(result).print(file)
    end

    assert_equal 200, response.status
  end
end
class UserFlowTest < ActionDispatch::IntegrationTest
  def test_index
    RubyProf.start
    User.all
    result = RubyProf.stop
    File.open "a.html", 'w' do |file|
      RubyProf::GraphHtmlPrinter.new(result).print(file)
    end
  end
end

byebug

https://news.ycombinator.com/item?id=7792623

If not, consider starting by writing a failing test.Get a stack trace (e.g. "raise 'omg'"). Set breakpoints (or litter the code with puts statements). Basically you want to follow the input and trace it through the various steps and figure out where did it stop working the way you expect. Sometimes it's easier to do this top-down, sometimes it is easier to go from bottom-up (trace the output back to the input). 

Where do I start?

http://blog.steveklabnik.com/posts/2012-07-05-how-can-i-contribute-to-ruby-on-rails-

http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html

self.i_suck_and_my_tests_are_order_dependent

Tests are failing for other Ruby implementations

Questions?

SG Ruby Meetup Talk

By tgxworld

SG Ruby Meetup Talk

  • 4,442