Skip to content

Instantly share code, notes, and snippets.

@AmirHooshangi
Created September 24, 2014 14:37
Show Gist options
  • Save AmirHooshangi/d98916ab254da5991b2d to your computer and use it in GitHub Desktop.
Save AmirHooshangi/d98916ab254da5991b2d to your computer and use it in GitHub Desktop.
######################################
CoffeeScript
######################################
@user_controller = ($scope, $http) ->
$scope.create_user = () ->
user =
user:
name: $scope.firstName
user_name: $scope.userName
password: $scope.passWord
$http.post('/user.json', user).success()
################################################
controller
################################################
include ActiveModel::Serializers::JSON
def create
user = User.new
puts params[:user]
user.from_json(params[:user])
user.save
render :nothing => true
end
################################################
Error
################################################
TypeError (no implicit conversion of ActionController::Parameters into String):
app/controllers/user_controller.rb:8:in `create'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment