我不知道出了什么问题,在生产模式下,一切都在 localhost 上运行,但是当我在 heroku 上托管它时,我遇到了这个问题。请帮我
12: <% @myestate.each do |prop| %>
13: <% @name = User.find_by_id(prop.user_id) %>
14: <tr>
15: <td><%= link_to @name.LastName, management_show_path(:user_id => @name.id) %></td>
16: </tr>
17: <% end %>
应用程序跟踪
app/views/management/index.html.erb:15:in `block in _app_views_management_index_html_erb___3570841627314272835_37900600'
app/views/management/index.html.erb:12:in `_app_views_management_index_html_erb___3570841627314272835_37900600'
app/controllers/management_controller.rb:9:in `index'
控制器索引操作
def index
@myestate1 = Estate.where(:Mgmt => current_user.Company)
@myestate = @myestate1.select("DISTINCT(user_id)")
respond_to do |format|
format.html # index.html.erb
format.json { render json: @managements }
end
end
错误信息
undefined method `LastName' for nil:NilClass