Rails 4 - undefined method build in using strong parameters

In my backoffice/users_controller.rb , I wrote a class to build the
permitted parameters

class Backoffice::UsersController < ApplicationController

class UserParams
    def build params
        params.require(:user).permit(:email, :password,

:password_confirmation )
end
end

but using it in the create method,
def create
@user = User.new(UserParams.build(params))

I get an error :
undefined method `build’ for
Backoffice::UsersController::UserParams:Class

I guess I am wrong somewhere as the class is defined in the Backoffice
module… where I am wrong ?

thanks for help

Thanks Colin… changed to :

private

def user_params
params.require(:user).permit(:email, :password,
:password_confirmation )
end

and cretae /update…
def create
@user = User.new(user_params)

Le mardi 17 septembre 2013 19:31:43 UTC+2, Colin L. a crit :

On 17 September 2013 18:27, Erwin [email protected] wrote:

In my backoffice/users_controller.rb , I wrote a class to build the
permitted parameters

class Backoffice::UsersController < ApplicationController

class UserParams
    def build params

If you want a class method (rather than instance) this should be
def self.build( params )

undefined method `build’ for Backoffice::UsersController::UserParams:Class

Because you have defined an instance method not a class method

Colin