Tommy

Joined

160 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in Setup Windows 10 Discussion

Elijah, you are the man (again) ! It worked, thanks a lot !

Posted in Setup Windows 10 Discussion

Hello again

I would like to be able to run rails commands from within the Visual Studio Code built-in terminal. They work fine on WSL terminals but I prefer to run them from within the VS code terminal. So when I ran something like "rails console" in VS Code, it said "The term 'rails' is not recognized as the name of a cmdlet, function, script file, or operable program ..." Upon some research on Google, someone suggests that the path to the rails/bin directory be added as an environmental variable. This is actually not hard. The hard part is to figure out where in the world rails was installed on WSL :-), can't find it. I know that my WSL was installed in C:\Users\tommy\AppData\Local\Packages but can't find the rails directory in Packages. Any idea ? Thanks again !

Posted in Setup Windows 10 Discussion

I got it. My Ruby on Rails app is up and running now. Thanks again!

Posted in Setup Windows 10 Discussion

Elijah, you are the man! Indeed, restarting my computer made a big difference. I was able to create a new rails app with everything in it. The problem I'm facing right now is that when I ran

rake db:create

FATAL: password authentication failed for user "xyz"
Couldn't create 'myapp_development' database. Please check your configuration.

rake aborted!

I don't recall I was asked to set a password during the installation of PostgreSQL, so in the database.yml, I specified the same username and password as those I used for creating the Window sub-system for Linux. Long story short, I have spent a good amount of time searching on Google and have tried various methods but none have worked so far. I'm almost there. A few questions for you:

  • How do I set a new password for the existing username (assuming it recognizes the existing username) in PostgreSQL ?

  • How do I set a new username and a new password in PostgreSQL ?

  • Should I (not) store the password in plain text in the database.yml or encript it in someway ?

Many thanks for your kind assistance so far !

Posted in Setup Windows 10 Discussion

Elijah, I appreciate your prompt assistance! I was able to run the above two commands ... However, when creating a new rails app:

rails new myapp -d postgresql

It seemed to have a file and directory permission issue that prevents the rest of the myapp directory from being created (please see below):

from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1346:in chmod': Operation not permitted @ apply2files - /mnt/c/code/myapp/bin (Errno::EPERM)
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1346:in
chmod'
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1038:in block (2 levels) in chmod_R'
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1493:in
preorder_traverse'
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1036:in block in chmod_R'
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1035:in
each'
from ~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/fileutils.rb:1035:in chmod_R'
from ~/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/actions/file_manipulation.rb:154:in
chmod'
...

I did set: chmod 700 fileutils.rb
I even set: chmod 777 ruby (on the ruby directory) but neither helped.

Any idea ? Thanks!

Posted in Setup Windows 10 Discussion

Hello, I was following the instruction here. When I created a new app:

rails new myapp -d postgresql

It created the "myapp" application without the config directory. In addition, when I installed the dependencies for Ruby, these two commands:

libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
libcurl4-openssl-dev software-properties-common libffi-dev

are not found (according to the terminal. All I did was "copy and paste" these commands, so there wasn't any potential typos there)

Because I later installed PostgreSQL, so hopefully, the command above for sqlite3 is not that necessary but the one for openSSL remains a concern.

Also, when I ran: rake db:create

rake aborted!
LoadError: cannot load such file -- /mnt/c/myapp/config/application
/mnt/c/myapp/rakefile:4:in require_relative'
/mnt/c/myapp/rakefile:4:in
'

Someone on this board suggests that "application" be changed to "application.rb" in Rakefile, I tried that but it didn't help. Also, my application was created with the config directory missing :-)

Sorry for multiple problems. Any help will be much appreciated. Thanks!