Sha256: 707659939edec35e879b638237c67cccbd41d887b2295d46c360227f26d85281

Contents?: true

Size: 613 Bytes

Versions: 54

Compression:

Stored size: 613 Bytes

Contents

# encoding: utf-8
class UsersController < ApplicationController


  def index
    @users = User.all
  end


  def create
    @user = User.new( user_params )
    if @user.save
      redirect_to users_path, notice: "User created!"
    else
      redirect_to root_path, alert: "Couldn't create User! .. #{ @user.errors.full_messages.join("<br />") }"
    end
  end



  private

    # Never trust parameters from the scary internet, only allow the white list through.
    def user_params
      params.require(:user).permit(:name, :address_attributes => [:street, :number, :postalcode, :city, :country])
    end

end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
magic_addresses-0.0.44 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.43 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.42 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.41 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.40 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc8 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc7 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc6 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc5 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc4 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc3 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc2 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.39.rc1 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.38 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.38.beta2 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.38.beta1 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.37 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.36 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.35 spec/dummy/app/controllers/users_controller.rb