title: Rails + AngularJS + Not able to access all the columns of the Single Model at View
body: <p>In my rails application, I am trying to fetch Logged-In-User details using AngularJS service. But while accessing the JSON from server I am getting only few columns rather than all the column present in model.</p>
  
  <p>Only FirstName, LastName, and Primary Email is visible on page and rest of the column are empty.</p>
  
  <p>I tried by direct hit of URL : <a href="http://www.example.com/LoggedInUserInfo.json" rel="nofollow">http://www.example.com/LoggedInUserInfo.json</a></p>
  
  <p><strong>Output : {"first_name":"User","last_name":"1","primary_email":"user_one@mailinator.com"}</strong></p>
  
  <p><strong>User Model</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    attr_accessible :blood_group,:city,:country,:first_name,:gender,:mobile_number,
    :phone_number,:primary_email,:secondary_email,:state,:street_address,
    :street_address2, :username, :zip_code
  </code></pre>
  
  <p><strong>Controller Method</strong></p>
  
  <pre><code>def logged_in_user_info
      @user = User.find(1)
      render :json =&gt; @user
      #render :json =&gt; @user.as_json(:only =&gt; [:first_name, :last_name, 
      #                                        :username, :date_of_birth])
  end
  </code></pre>
  
  <p><strong>AngularJS Service</strong></p>
  
  <pre><code>var user_app = angular.module("UserApp", []);
  user_app.controller("LoggedInUserInfoCtrl", function($scope, $http) {
    $http.get('/LoggedInUserInfo.json').
      success(function(data, status, headers, config) {
        $scope.logged_in_user = data;
      }).
      error(function(data, status, headers, config) {
        // log error
      });
  });
  </code></pre>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>match '/LoggedInUserInfo' =&gt; 'dashboard#logged_in_user_info', :via =&gt; [:get]
  </code></pre>
  
  <p>Please suggest some thing to bring all the columns. I think every thing has to be done with Rails Controller. Thanks in advance.</p>