Created
September 24, 2014 14:37
-
-
Save AmirHooshangi/d98916ab254da5991b2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################### | |
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