Skip to content

Instantly share code, notes, and snippets.

@hugodias
Last active March 23, 2016 15:57
Show Gist options
  • Save hugodias/9950b131fcefc6f235d9 to your computer and use it in GitHub Desktop.
Save hugodias/9950b131fcefc6f235d9 to your computer and use it in GitHub Desktop.
Qual é a melhor maneira de alterar dentro params?
class RealtiesController < ApplicationController
before_action :set_realty, :only => [:update]
def update
@realty.status = 3
if @realty.update_attributes(realty_update_params)
redirect_to conta_imoveis_path
end
end
private
def set_realty
@realty = Realty.find(params[:id])
end
def realty_update_params
params.require(:realty).permit(:title)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment