Skip to content

Instantly share code, notes, and snippets.

@guivinicius
Created October 31, 2012 23:16
Show Gist options
  • Select an option

  • Save guivinicius/3990561 to your computer and use it in GitHub Desktop.

Select an option

Save guivinicius/3990561 to your computer and use it in GitHub Desktop.

Revisions

  1. guivinicius revised this gist Oct 31, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    # Ruby


    ``` ruby
    products = [
    {name: 'macbook', price: 5000},
    {name: 'pokemon', price: 100}
    {name: 'livro', price: 50}
    ]
    ```

    Faça a soma dos valores utilizando a função inject.

  2. guivinicius revised this gist Oct 31, 2012. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    # Ruby

    products = [
    {name: 'macbook', price: 5000},
    {name: 'pokemon', price: 100}
    {name: 'livro', price: 50}
    ]

    products = [
    {name: 'macbook', price: 5000},
    {name: 'pokemon', price: 100}
    {name: 'livro', price: 50}
    ]

    Faça a soma dos valores utilizando a função inject.

  3. guivinicius created this gist Oct 31, 2012.
    19 changes: 19 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # Ruby

    products = [
    {name: 'macbook', price: 5000},
    {name: 'pokemon', price: 100}
    {name: 'livro', price: 50}
    ]

    Faça a soma dos valores utilizando a função inject.

    # Rails

    Crie os modelos dos seguintes relacionamentos.

    * Um curso pode ter várias disciplinas.
    * Uma disciplina pode pertencer a vários cursos.
    * Um curso pode ter várias turmas.
    * Uma turma tem vários alunos.
    * Um curso pode ter vários alunos através de turmas.