Skip to content

Instantly share code, notes, and snippets.

@thomasstr
Created October 15, 2013 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasstr/6990719 to your computer and use it in GitHub Desktop.
Save thomasstr/6990719 to your computer and use it in GitHub Desktop.
SQLite3::SQLException: near "to": syntax error: SELECT 1 AS one FROM "registerhours" WHERE (registerhours.to >= '2013-10-15 16:00:00.000000' AND registerhours.from <= '2013-10-15 17:00:00.000000') ORDER BY created_at DESC LIMIT 1
class Registerhour < ActiveRecord::Base
belongs_to :project
belongs_to :admin
validates_presence_of :project, :timetype
#validate :from_time_cannot_be_after_to_time
validates :from, :to, :overlap => true
end
def create
@registerhour = Registerhour.new(registerhour_params)
#@registerhour.date_today = Date.today
respond_to do |format|
if @registerhour.save
format.html { redirect_to my_hours_url, notice: 'Timer registrert.' }
format.json { render action: 'show', status: :created, location: @registerhour }
else
format.html { render action: 'new' }
format.json { render json: @registerhour.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment