Created
October 15, 2013 12:19
-
-
Save thomasstr/6990719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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