{"action":"closed","issue":{"url":"https://api.github.com/repos/ga-dc/pbj-project2/issues/108","labels_url":"https://api.github.com/repos/ga-dc/pbj-project2/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/ga-dc/pbj-project2/issues/108/comments","events_url":"https://api.github.com/repos/ga-dc/pbj-project2/issues/108/events","html_url":"https://github.com/ga-dc/pbj-project2/issues/108","id":99245060,"number":108,"title":"Undefined Method","user":{"login":"siltastic","id":10377524,"avatar_url":"https://avatars.githubusercontent.com/u/10377524?v=3","gravatar_id":"","url":"https://api.github.com/users/siltastic","html_url":"https://github.com/siltastic","followers_url":"https://api.github.com/users/siltastic/followers","following_url":"https://api.github.com/users/siltastic/following{/other_user}","gists_url":"https://api.github.com/users/siltastic/gists{/gist_id}","starred_url":"https://api.github.com/users/siltastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siltastic/subscriptions","organizations_url":"https://api.github.com/users/siltastic/orgs","repos_url":"https://api.github.com/users/siltastic/repos","events_url":"https://api.github.com/users/siltastic/events{/privacy}","received_events_url":"https://api.github.com/users/siltastic/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-05T16:31:47Z","updated_at":"2015-08-05T16:40:14Z","closed_at":"2015-08-05T16:40:14Z","body":"I'm having trouble with my create route. I'm using Devise and I need to find the current_user.\r\n![Image of Error](http://cl.ly/c9SL/Screen%20Shot%202015-08-05%20at%2012.29.41%20PM%201.png)\r\nroutes.db\r\n\r\n```ruby\r\nRails.application.routes.draw do\r\n  devise_for :users\r\n\r\n  # Trigger the index action in our posts controller.\r\n  root to: 'prints#index'\r\n  \r\n  # Generate RESTful routes for the models.\r\n  resources :prints do\r\n    resources :comments\r\n  end\r\nend\r\n```\r\n\r\nprints_controller.rb\r\n```ruby\r\nclass PrintsController < ApplicationController\r\n  # Create the index route.\r\n  # Order by most recent.\r\n  def index\r\n    @prints = Print.all\r\n  end\r\n\r\n  # Create the new route.\r\n  # Create a new print.\r\n  def new\r\n    @print = Print.new\r\n  end \r\n\r\n  # Create the create route.\r\n  def create\r\n    @print = Print.create!(print_params)\r\n\r\n    # Redirect it to the index page.\r\n    redirect_to action: \"index\"\r\n  end\r\n\r\n  # # Create the show route.\r\n  # # Find the specific ID for each print.\r\n  # def show\r\n  #   @print = Print.find(params[:id])\r\n  # end\r\n\r\n  # # Create the edit route.\r\n  # # Find the specific ID for each print.\r\n  # def edit\r\n  #   @print = Print.find(params[:id])\r\n  # end\r\n\r\n  # # Create the upddate route.\r\n  # def update\r\n  #   @print = Print.find(params[:id])\r\n  #   @print.update(print_params)\r\n\r\n  #   # Redirect it to the index page.\r\n  #   redirect_to action: \"index\"\r\n  # end\r\n\r\n  # # Create the destroy route.\r\n  # def destroy\r\n  #   @print = Print.find(params[:id])\r\n  #   @print.destroy\r\n\r\n  #   # Redirect it to the index page.\r\n  #   redirect_to action: \"index\"\r\n  # end\r\n  \r\n  # Add strong params for privacy.\r\n  # Create a help method for permissions and privacy (strong params).\r\n  private\r\n  def print_params\r\n    params.require(:print).permit(:category, :creator_individual, :creator_company, :title, :photo, :series, :purchase_date, :purchase_price, :user_id)\r\n  end\r\nend\r\n```\r\n\r\nindex.html.erb\r\n```ruby\r\n<% current_user.prints.each do |print|  %>\r\n  <div>\r\n    <%= link_to image_tag(print.photo.to_s), print_path(print) %>\r\n    <h1><%= link_to print.title, print %></h1>\r\n    <h2><%= link_to print.creator_individual, print %></h2>\r\n    <h2><%= link_to print.creator_company, print %></h2>\r\n  </div>\r\n<% end %>\r\n```\r\n\r\nWhat I thought might work since the variable was possibly not defined?\r\nprints_controller\r\n```ruby\r\n  def index\r\n    @prints = Print.all\r\n    @user = current_user\r\n  end\r\n```\r\n\r\nindex.html.erb\r\n```ruby\r\n<% @user.prints.each do |print|  %>\r\n  <div>\r\n    <%= link_to image_tag(print.photo.to_s), print_path(print) %>\r\n    <h1><%= link_to print.title, print %></h1>\r\n    <h2><%= link_to print.creator_individual, print %></h2>\r\n    <h2><%= link_to print.creator_company, print %></h2>\r\n  </div>\r\n<% end %>\r\n```"}}