Skip to content

Instantly share code, notes, and snippets.

@bastos
Forked from bmizerany/from.rb
Created December 12, 2008 15:49
Show Gist options
  • Select an option

  • Save bastos/35164 to your computer and use it in GitHub Desktop.

Select an option

Save bastos/35164 to your computer and use it in GitHub Desktop.

Revisions

  1. @bmizerany bmizerany revised this gist Dec 10, 2008. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion to.rb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    get '/:id.?:format?' do
    @vent = Vent.get(params[:id])
    case :format
    case params[:format]
    when 'xml'
    builder :show
    else
  2. @bmizerany bmizerany created this gist Dec 10, 2008.
    10 changes: 10 additions & 0 deletions from.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    get '/:id' do
    @vent = Vent.get(params[:id])
    erb :show
    end

    # show post
    get '/:id.xml' do
    @vent = Vent.get(params[:id])
    builder :show
    end
    13 changes: 13 additions & 0 deletions to.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    ## Using ? will make the previous section optional
    ## NOTE the ? after the .

    get '/:id.?:format?' do
    @vent = Vent.get(params[:id])
    case :format
    when 'xml'
    builder :show
    else
    erb :show
    end
    end