Skip to content

Instantly share code, notes, and snippets.

@pier-oliviert
Created April 21, 2014 21:50
Show Gist options
  • Select an option

  • Save pier-oliviert/11157758 to your computer and use it in GitHub Desktop.

Select an option

Save pier-oliviert/11157758 to your computer and use it in GitHub Desktop.
Simple Controller.
class ThingsController
def create
@thing = Thing.new(thing_params)
thing.creator = current_user
thing.save!
Stats.count("Thing Created", 1)
Thing.delay.send_notifications(thing.id)
end
def update
thing.update!(thing_params)
end
protected
def thing
@thing ||= Thing.find(params[:id])
end
def thing_params
params.expect(:thing).permit(:foo, :bar)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment