rest_account.diff

patch against 0.9-stable - Jérémy Lal, 2010-01-16 18:11

Download (1.5 KB)

View differences:

app/controllers/my_controller.rb
17 17

  
18 18
class MyController < ApplicationController
19 19
  before_filter :require_login
20

  
20
  accept_key_auth :index
21 21
  helper :issues
22 22
  helper :custom_fields
23 23

  
......
39 39

  
40 40
  def index
41 41
    page
42
    render :action => 'page'
42
    respond_to do |format|
43
      format.html { render :action => 'page' }
44
      format.xml { render :xml => @user.to_xml }
45
      format.json { render :json => @user.to_json }
46
    end
43 47
  end
44 48

  
45 49
  # Show user's page
config/routes.rb
17 17
  map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
18 18
  map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
19 19
  map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
20

  
21
  map.with_options :controller => 'my' do |my_routes|
22
    my_routes.with_options :conditions => {:method => :get} do |my_views|
23
      my_views.connect 'my/account.:format', :action => 'index'
24
    end
25
  end
20 26
  
21 27
  map.with_options :controller => 'timelog' do |timelog|
22 28
    timelog.connect 'projects/:project_id/time_entries', :action => 'details'