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.34 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.33 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.32 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.31 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.30 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.29 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.28 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.27 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.26 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.25 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.24 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.23 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.22 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.21 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.20 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.19 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.18 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.17 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.16 spec/dummy/app/controllers/users_controller.rb
magic_addresses-0.0.15 spec/dummy/app/controllers/users_controller.rb