[SOLVED] Can't find app/channels directory in Rails 5 app

rails

#1

I added gem 'rails', '5.0.0.1' to my Gemfile, removed the older version of rails, did bundle install, and created the app using rails _5.0.0.1_ new appname. I’m following this article. According to this, in Rails 5, I should have a directory named channels inside /app but I’m not seeing it. Did I not update to Rails 5 correctly? What’s the problem?


#2

Try installing the latest version of Rails directly from your terminal (preferably in a new custom workspace):

sudo gem install rails

Once rails is installed, create the new application:

rails new <name>

You should see the app/channels directory.


#3

So I created a new workspace and ran sudo gem install rails in the username:~/workspace directory and it installed the latest version of rails alright. I then ran rails new appname and got the “Can’t initialize a new Rails application within the directory of another, please change to a non-Rails directory first” error. So I deleted all the files in the username:~/workspace/bin directoy and ran rails new appname again and it created the app successfully. However, I still don’t see the app/channels directory inside username:~/workspace/appname. When I run gem list there, it shows rails (5.0.0.1, 4.2.5).


#4

Can’t initialize a new Rails application within the directory of another, please change to a non-Rails directory first

You probably created a new Ruby type workspace. You should create a Custom type workspace. This is because the Ruby type workspace already comes with Rails 4 and an application directory already created inside the workspace directory.


#5

Thanks! I created a blank workspace and I’m seeing the app/channels directory now after creating the app!

So since I had to create an entirely new workspace to get Rails 5 working, does it mean existing Rails 4 apps can’t be updated?


#6

If you mean upgrading Rails 4 applications to Rails 5, take a look at this link: http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html

If you mean updating your workspace to Rails 5, you can uninstall the Rails 4 gem and then run sudo gem install rails to install Rails 5.


#7

I tried to update rails-4.2 to rails-5.0.1 . for that I installed ruby2.4.1 and then create new workspace(gemset) and then bundle install.

Now application is showing rails-5 version.but still couldn’t get (channels and mailer and preview mailer ) folder.

I tried above link which you mentioned.