Sha256: 574b510194aa75aed6ba90c013445742e397a946c073502c260620443af080bb

Contents?: true

Size: 950 Bytes

Versions: 64

Compression:

Stored size: 950 Bytes

Contents

class Users < Application
  # GET /users
  def index
    @users = User.all
    display @users
  end
  
  # GET /users/1
  def show(id)
    @user = User.get(id)
    raise NotFound unless @user
    display @user
  end
  
  # GET /users/new
  def new
    only_provides :html
    @user = User.new
    display @user
  end
  
  # GET /users/1/edit
  def edit(id)
    only_provides :html
    @user = User.get(id)
    raise NotFound unless @user
    display @user
  end
  
  # POST /users
  def create(user)
    @user = User.new(user)
    if @user.save
      redirect resource(@user), :message => {:notice => "User was successfully created"}
    else
      message[:error] = "User failed to be created"
      render :new
    end
  end
  
  # PUT /users/1
  def update(id, user)
    @user = User.get(id)
    raise NotFound unless @user
    if @user.update_attributes(user)
       redirect resource(@user)
    else
      display @user, :edit
    end
  end
end

Version data entries

64 entries across 64 versions & 15 rubygems

Version Path
state_machine_updated_for_ruby_3_2-2.0.0 examples/merb-rest/controller.rb
telvue_state_machine-1.2.3 examples/merb-rest/controller.rb
telvue_state_machine-1.2.2 examples/merb-rest/controller.rb
state_machine_deuxito-0.0.1 examples/merb-rest/controller.rb
telvue_state_machine-1.2.1 examples/merb-rest/controller.rb
cm-state_machine-1.2.0.1 examples/merb-rest/controller.rb
spree-state_machine-2.0.0.beta4 examples/merb-rest/controller.rb
spree-state_machine-2.0.0.beta3 examples/merb-rest/controller.rb
spree-state_machine-2.0.0.beta2 examples/merb-rest/controller.rb
spree-state_machine-2.0.0.beta1 examples/merb-rest/controller.rb
culturecode-state_machine-1.2.1 examples/merb-rest/controller.rb
joelind-state_machine-0.8.1 examples/merb-rest/controller.rb
pluginaweek-state_machine-0.7.6 examples/merb-rest/controller.rb
pluginaweek-state_machine-0.8.0 examples/merb-rest/controller.rb
automat-1.2.0 examples/merb-rest/controller.rb
glebtv_state_machine-1.3.0 examples/merb-rest/controller.rb
state_machine-1.2.0 examples/merb-rest/controller.rb
state_machine-1.1.2 examples/merb-rest/controller.rb
state_machine-1.1.1 examples/merb-rest/controller.rb
state_machine-1.1.0 examples/merb-rest/controller.rb