Skip to content

Instantly share code, notes, and snippets.

2.0.0p195 :027 > Task.last
Task Load (0.4ms) SELECT "tasks".* FROM "tasks" ORDER BY "tasks"."id" DESC LIMIT 1
=> #<Task id: 13, title: nil, task_category_id: nil, due_date: "2013-07-28 18:11:00", description: "Hello", completed_at: nil, company_id: 5, contact_id: 0, user_id: nil, created_at: "2013-07-28 18:11:00", updated_at: "2013-07-28 18:11:00">
2.0.0p195 :028 > Task.where(due_date: Date.today)
Task Load (0.4ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."due_date" = '2013-07-28'
=> []
2.0.0p195 :029 >
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# title :text
# task_category_id :integer
# due_date :datetime
# description :text
# completed_at :datetime
@biographie
biographie / _add_task.html.erb
Last active December 20, 2015 08:59
error in console: Uncaught TypeError: Accessing selectionDirection on an input element that cannot have a selection. application.js?body=1:51 Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:3000/companies/5/tasks
<div class="add-task arrow_box hide">
<%= form_for ([@company, @task]), :remote => true do |f| %>
<%= f.label :description %>
<%= f.text_field :description, :class => "input-width bottom-border" %>
<%= f.label :task_category_id, "Choose a category" %>
<%= f.collection_select(:task_category_id, TaskCategory.all, :id, :task_category) %>
<%= f.label :due_date %>
<%= f.select :due_date_word, ['Today', 'Tomorrow', 'Next Week']%>
Started GET "/assets/companies.js?body=1" for 127.0.0.1 at 2013-07-29 17:47:00 +0300
Served asset /companies.js - 304 Not Modified (0ms)
Started GET "/assets/contacts.js?body=1" for 127.0.0.1 at 2013-07-29 17:47:00 +0300
Served asset /contacts.js - 304 Not Modified (0ms)
Started GET "/assets/colorbox-rails/jquery.colorbox-min.js?body=1" for 127.0.0.1 at 2013-07-29 17:47:00 +0300
Served asset /colorbox-rails/jquery.colorbox-min.js - 304 Not Modified (0ms)
class Post < ActiveRecord::Base
belongs_to :user
before_save :default_values
def default_values
self.cached_votes_total ||= 1
end
acts_as_votable
end