Home ActiveRecord::StatementInvalid in UsersController#show
Reply: 2

ActiveRecord::StatementInvalid in UsersController#show

Chips
1#
Chips Published in 2018-02-14 11:01:41Z

It's impossible to go to this address: 127.0.0.1/users/sign_up. When I go to the page, I get the following error:

OCIError: ORA-01722: invalid number: SELECT * FROM (SELECT "BLACKROW"."V_B_USERS".* FROM "BLACKROW"."V_B_USERS" WHERE (USER_ID = 'sign_up') ORDER BY "BLACKROW"."V_L_USERS"."USER_ID" ASC ) WHERE ROWNUM <= 1

On this action there is an error:

# Use callbacks to share common setup or constraints between actions.

    def set_user
      @user = User.where('USER_ID = ?', params[:id]).first
    end

What's wrong? And how can this be remedied?

Littlefoot
2#
Littlefoot Reply to 2018-02-14 11:07:11Z
... WHERE (USER_ID = 'sign_up') 

"ID" usually (once again: usually) means a NUMBER. If you have a look at the V_L_USERS table, what does it say - what is USER_ID data type? If it really is a NUMBER, then using a string (which 'sign_up' is) against it will raise the INVALID NUMBER error.

Ben Watkins
3#
Ben Watkins Reply to 2018-02-14 11:12:28Z

It seems it's an issue with your ID parameter.

Side note: a cleaner way to find the user would be with Users.find(params[:id])

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.337049 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO