title: Ruby on Rails The action could not be found for controller
body: <p>My rails app says:</p>
  
  <pre><code>The action 'myjson' could not be found for UsersController
  </code></pre>
  
  <p>I've read all day other posts and it seems it's mostly caused by a missing end or something else. But I really don't think it's this because I've really tried to look it up and found nothing. So I'm turning to you for some help. Here's my controller code:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
   helper_method :sort_column, :sort_direction  #method in helpers to sort
   before_filter :signed_in_user, only: [:edit, :update, :destroy] 
   before_filter :correct_user,   only: [:edit, :update]
   before_filter :admin_user,     only: [:destroy]
  
   def index
    @user = current_user
    @usersall = User.all
    @users =User.order(sort_column + " " + sort_direction).paginate(:per_page =&gt; 10, :page =&gt; params[:page])
    @rank = User.select("users.name, sum(credits.score) AS rank").joins(:credits).group("credits.user_id").all
  end
  
   def destroy
    User.find(params[:id]).destroy
    flash[:success] = "User destroyed."
    redirect_to users_path
   end
  
   def create
  
     if User.exists?(:email =&gt; params[:user][:email])
      flash.now[:error] = "A user with this email already exists"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
     elsif params[:user][:password] != params[:user][:password_confirmation]
      flash.now[:error] = "The passwords do not match. Try again"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
     elsif params[:user][:email] !~ /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
      flash.now[:error] = "Invalid email"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
     elsif params[:user][:name] == nil
      flash.now[:error] = "The name field cannot be empty"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
     elsif params[:user][:password].length &lt; 6
      flash.now[:error] = "Password is too short (minimal length: 6)"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
     else
      @user = User.new(params[:user])
      @user.save
      redirect_to @user
     end
  end
  
  def show
    @user = User.find(params[:id])
    render :layout =&gt; 'user-layout.html.erb' #use a special layout
  end
  
  def edit
    render :layout =&gt; 'user-layout.html.erb' #use a special layout
  end
  
  def update
    if User.exists?(:email =&gt; params[:user][:email]) &amp;&amp; params[:user][:email] != @user.email
      flash.now[:error] = "A user with this email already exists"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
    elsif params[:user][:new_password] != params[:user][:password_confirmation]
      flash.now[:error] = "The passwords do not match. Try again"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
    elsif params[:user][:email] !~ /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
      flash.now[:error] = "Invalid email"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
    elsif params[:user][:name] == nil
      flash.now[:error] = "The name field cannot be empty"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
    elsif !@user.authenticate(params[:user][:password])
      flash.now[:error] = "Entered password doesn't match with the one previously saved"
      render :action =&gt; :new, :layout =&gt; 'signin-layout.html.erb'
    else
  
      @user.update_attribute(:name, params[:user][:name])
      @user.update_attribute(:email, params[:user][:email])
  
      if params[:user][:new_password] == params[:user][:password_confirmation] &amp;&amp; params[:user][:new_password].length &gt; 6
      @user.update_attribute(:password, params[:user][:new_password])
    end
  
    sign_in @user
    redirect_to @user
   end
  end
  
  
  def upAdmin
    @user = User.find(params[:id])
    if @user.update_attribute(:admin,true)
      flash[:success] = "Profile updated, welcome to the new admin"
      redirect_to @user
    else
      flash[:error] = "Profile can't be upgraded to admin !'"
      redirect_to @user
    end
  end
  
  def downAdmin
    @user = User.find(params[:id])
    if @user.update_attribute(:admin,false)
      flash[:success] = "Profile updated, bye to the old admin"
      redirect_to @user
    else
      flash[:error] = "Profile can't be updated !'"
      redirect_to @user
    end
  end
  
  def myteam
    @user = User.find(params[:id])
    if @user.team_id != nil
      @team = Team.find @user.team_id
    end
    render layout: 'user-layout.html.erb'
  end
  
  def myjson
    render :layout =&gt; 'myjson.html.erb'
  end
  
  def myprojects
    @user = User.find(params[:id])
    render layout: 'user-layout.html.erb'
  end
  
  def mydevices
    @user = User.find(params[:id])
    render layout: 'user-layout.html.erb'
  end
  
  def mypins
    @user = User.find(params[:id])
    render layout: 'user-layout.html.erb'
  end
  
  private
  
  def sort_column
    User.column_names.include?(params[:sort]) ? params[:sort] : "name"
  end
  
  def sort_direction
    %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
  end
  
  def signed_in_user
    redirect_to signin_path, notice: "Please sign in." unless signed_in?
  end
  
  def correct_user
    @user = User.find(params[:id])
    redirect_to(root_path) unless (current_user?(@user) || current_user.admin?)
  end
  
  def admin_user
    redirect_to(root_path) unless current_user.admin?
  end
  
  end
  </code></pre>
  
  <p>So I hope I just missed it and it's nothing serious. Just in case this is my routes.rb for the users : </p>
  
  <pre><code>get "users/new"
  
    resources :users do
      member do
        get 'myteam'
        get 'myprojects'
        get 'mydevices'
        get 'mypins'
        get 'upAdmin'
        get 'downAdmin'
        get 'myjson'
      end
    end
  </code></pre>
  
  <p>Thanks for any help in advance</p>