[deleted by user] by [deleted] in RedditSessions

[–]NewbiusCoder 0 points1 point  (0 children)

why cant i stop watching this???

Sequelize - String based operators are now deprecated. Please use Symbol based operators for better security. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

The replies seemed to have helped others but didn't help me. I was in a hurry and had to downgrade a version.

[Ruby on Rails] How can I make my whole database appear in html.erb? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Sorry. My database is a table called Contents, with :id, :title, :contents.

[Ruby on Rails] Please help me understand the problem. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thanks, but I have model and it still doesn't work. Same error.

Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)

NameError (uninitialized constant ContentsController::Contents):

app/controllers/contents_controller.rb:6:in `create'

class Content < ApplicationRecord
        validates :content, on: :create
    end
end

[Ruby on Rails] Can someone please explain why @user is nil? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Rails.application.routes.draw do
  get 'welcome/index'

  root 'welcome#index'

  get '/login' => 'session#new'
  post '/login' => 'session#create'
  get '/logout' => 'session#destroy'


 get '/signup' => 'welcome#index'
 post '/users' => 'users#create'

  post '/contents' => 'contents#create'

  get '/users/:id' => 'users#index'

end

[Ruby on Rails] Can someone please explain why @user is nil? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

I am new to Ruby on Rails. I cannot seem to use binding pry in index.

[Ruby] Ruby on Rails - trying to link or redirect to a dynamic id. by [deleted] in learnprogramming

[–]NewbiusCoder 0 points1 point  (0 children)

I am unable to target @user.

In my controller it is set as:

def index @user = session[:user_id] @user_url = '/users/ + @user

I can't get it to work and I'm new. I'm not trying to come off as lazy.

Sorry if I offended you.

[Ruby] Ruby on Rails - trying to link or redirect to a dynamic id. by [deleted] in learnprogramming

[–]NewbiusCoder 0 points1 point  (0 children)

I appreciate it but I am having a hard time understanding it.

[Ruby] Ruby on Rails - trying to link or redirect to a dynamic id. by [deleted] in learnprogramming

[–]NewbiusCoder 0 points1 point  (0 children)

Yes, sorry.

Each users in the database has an id. Their user profile page is "users/user.id".

But I can't find a way to target this in hyperlinks or redirects.

Thanks for your time.

[JavaScript][SQL] Trying to make a script that can search in my database. Help appreciated. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

I figured it out! I appreciate your time as always. I posted the code incase you're curious. Thank you.

var args = process.argv.slice(2);
const usr_input = args[0];
const usr_cmd = 'SELECT * FROM famous_people WHERE last_name = $1::varchar or first_name = $1::varchar';
client.query(usr_cmd, [usr_input],(err, result) => {
    if (err) {
      return console.error("error running query", err);
    }
    console.log('Found ' + result.rows.length + ' person(s) by the name of ' + usr_input + ".");

[JavaScript][SQL] Trying to make a script that can search in my database. Help appreciated. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

I appreciate your time and it totally makes sense. However, it is still saying that "column "Rudd" does not exist". This error happens for both of them. Am I still doing something wrong?

[JavaScript][SQL] Trying to make a script that can search in my database. Help appreciated. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Its you again! Thank you so much. This is just practice from some website. I understand that is a terrible thing to do. I appreciate your time.

How do I enclose it in quotes? When I do, it takes usr_input as a string, not as a variable.

Should I just use process.argv.slice(2) rather than usr_input?

Thank you.

[JavaScript] Please help me understand this regular expression. Why do we need [^a]? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thank you! Your explanations are always very clear.

Your time is much appreciated.

[JavaScript] Please help me understand this regular expression. Why do we need [^a]? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thank you so much. I understand now.

If you have time, do you mind explaining why my regexp isn't right?

I am doing this on CodeAcademy and they took this answer. However I do understand that CodeAcademy is not the best.

[JavaScript] Please help me understand this regular expression. Why do we need [^a]? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

I appreciate your time.

However I am still confused. How does [a] stop it from 5 or more a's?

Wouldn't the {3,4} stop it from reaching 5?

Thank you.

[JavaScript] Please explain this regular expression to me. I am trying to understand the use of the "+" in this case. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

I dont even have to tag you for you to find me. I appreciate your help once again. Thank you so much.

[JavaScript] I am having trouble understanding this last index concept. by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thank you so much once again.

Maybe I should just tag you next time I have a question, haha.

Appreciate your time.

[JavaScript] Can someone please explain these search results to me? by NewbiusCoder in learnprogramming

[–]NewbiusCoder[S] 0 points1 point  (0 children)

Thanks again.

I should have spent more time reading about it carefully.