Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Rails PG::UndefinedTable: ERROR: missing FROM-clause entry for table

The only thing you've added is a where-clause. Seems like it's problematic:

where(agency: {state: 'active'})

...and produces a wrong condition because hash key in this case is expected to mean a table name. You should probably have this:

where(agencies: {state: 'active'})


Seeing this attract quite a lot of attention, I think I should also suggest a different way of doing the same, slightly more composable:

merge( Agency.where(state: 'active') )

How is this one better? It allows you to use scopes:

# Inside Agency
scope :active, -> { where(state: 'active') }

# Somewhere else

Categories : SQL

Related to : Rails PG::UndefinedTable: ERROR: missing FROM-clause entry for table
Rails Template is Missing Error
Notice how your controller action and your error says pages/show_admin_panel (with underscores) but your view is called pages/adminpanel.html.erb (no underscores and no "show" part in the beginning).

Categories : Ruby On Rails
MySQL duplicate entry error even though it is not a duplicate entry
number is defined as integer value and 2147483647 is the maximum value a signed integer can take (minimum -2147483648). I guess in your create statement is the fact missing that number is defined as unique key. You should have a look at your actual table definition. The one you provided here could not be reason. Then number would just be 2147483647 after insertion with no error message.

Categories : PHP
MySQL can’t specify target table for update in FROM clause
You could do this: UPDATE oxarticles a LEFT JOIN oxarticles b ON a.oxid=b.oxparentid SET a.oxean =b.oxean, a.oxstock =b.oxstock , a.oxinsert =b.oxinsert

Categories : Mysql
subquery in sybase Create table clause
this case: create table LIQ_PURGE_AK as select M_REFERENCE from LPOS_AK_DBF where M_PRIC_TYPE in (2, 3) you could change to: select M_REFERENCE into LIQ_PURGE_AK from LPOS_AK_DBF where M_PRIC_TYPE in (2, 3) all other case you could leave "AS IS". You could be free with subquery in the delete clause (but could be exceptions with a group by)

Categories : Oracle
How to define custom table mapping by Config.groovy entry in Grails
I believe you can read the config variables right from your mapping block. So this line in the app consuming your plugin's Config.groovy grails.myplugin.useIndexForFoo = true Should allow you to have a configurable domain class, such as class Foo { String myString static mapping = { if (Holders.config?.grails?.myplugin?.useIndexForFoo) myString index: "myString_idx

Categories : Grails
Recently Add
Use REGEXP_REPLACE to replace variable number of characters with same number of constant characters
How to subtract a data with nano-second in a same group
listagg alternative in Oracle
How to join 3 tables to a single table in SQL
Postgresql: Trying to Understand the Information Schema Table Constraints Info for a NOT NULL Contstraint
Data Frame in R use like SQL, possibly using sqldf()
How can I group by a table by the date?
Query slows down in Conditional IF
Getting the daily sales report given the date
Retrieve rows with unique values in a column
case sensitive sql search in
Oracle multi dimensional query
Update column when datediff is greater then other column in the same table
add value from different tables and insert total value into another table
How to prevent transaction locking in sql server for all the connections?
Check the query efficiency
how can I run this select statement inside a select statement without any problems?
Add amount once on duplicate entries
SQL Server 2012 - Unique Priority Column
Query: employees who do not have the same name
Trigger to not allow a member to rent if unpaid balance exceeds $50
Anyway way to change this Oracle SQL statment to use regs?
If you set a field name as an Alias, can you utilize that name within SQL code?
Increment next month with dayOfTheMonth SQL sybase
Update Table Set From is not working as expected
How do I find one matching strings in two txt files
SQL help needed (oracle application express)
How to Roll Up Weekending Data in SQL
How do you call a variable (that is a list of values) in a conditional statement?
Oracle INSTR backward in Oracle SQL
© Copyright 2017 Publishing Limited. All rights reserved.