I'm using meta_search and meta_where gem.In my controller file:
@search = Project.where('end <= ?', Time.zone.now)
@search = @search.search(params[:search])
When I run this code I have error in browser like this
PG::Error: ERROR: syntax error at or near "end"
You may not have an 'end' column on projects, which could mean that you either have a migration and forgot to run it with rake db:migrate
, or need to make a migration to add that column. If the column name were end_date, you could do:
rails g migration add_end_date_to_projects end_date:date
Then run the migration.
EDIT: 'end' is a reserved word in PostgreSQL, so I think the column will need to be renamed.
See: http://www.postgresql.org/docs/8.3/static/sql-keywords-appendix.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.