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 UsersField < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :field | |
has_one :fields_group, through: :field | |
validates :value, allow_blank: true | |
def create_record | |
if !self.field.required & self.value.blank? |
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
<%= simple_form_for @product do |f| %> | |
<%= f.simple_fields_for :attributes do |d| %> | |
<% f.object.attributes.try(:each) do |key, value| %> | |
<%= d.input key, :input_html => {:value => value } %> | |
<% end %> | |
<% end %> | |
<% 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
Exception in thread "main" java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure | |
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. | |
at no.priv.garshol.duke.utils.JDBCUtils.open(JDBCUtils.java:52) | |
at no.priv.garshol.duke.datasources.JDBCDataSource.getRecords(JDBCDataSource.java:67) | |
at no.priv.garshol.duke.Processor.index(Processor.java:355) | |
at no.priv.garshol.duke.Processor.link(Processor.java:268) | |
at no.priv.garshol.duke.Duke.main_(Duke.java:166) | |
at no.priv.garshol.duke.Duke.main(Duke.java:38) | |
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure |
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
<duke> | |
<schema> | |
<threshold>0.8</threshold> | |
<path>temp</path> | |
<property type="id"> | |
<name>ID</name> | |
</property> | |
<property> |
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
# Source: http://timcardenas.com/automatically-reload-gems-in-rails-327-on-eve | |
# Inside config/environments/development.rb | |
# Do the following after every request to the server in development mode | |
ActionDispatch::Callbacks.to_cleanup do | |
# If the gem's top level module is currently loaded, unload it | |
if Object.const_defined?(:MyCoolGem) |
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 FileQueue | |
def initialize(file_name) | |
@file_name = file_name | |
end | |
def push(obj) | |
safe_open('a') do |file| | |
file.write(obj + "\n") | |
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
<html> | |
<head> | |
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$("a").click(function(e){ | |
alert("vfvfvf"); | |
e.preventDefault(); | |
}); |
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 self.student_search(params) | |
self.search( :full_name_or_user_email_or_role_student_type_teacher_or_home_phone_number_or_mobile_phone_number_contains => params) | |
end | |
def self.parent_search params | |
self.search( :full_name_or_user_email_or_role_parent_type_employer_or_role_parent_type_work_email_or_role_parent_type_work_phone_number_or_home_phone_number_or_mobile_phone_number_contains => params) | |
end | |
def self.joined_search(params) | |
self.search( :full_name_or_user_email_or_role_student_type_teacher_or_home_phone_number_or_mobile_phone_number_or_role_parent_type_employer_or_role_parent_type_work_email_or_role_parent_type_work_phone_number_or_home_phone_number_or_mobile_phone_number_contains => params) |
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
HTTP/1.1 302 Moved Temporarily | |
Date: Fri, 06 Jul 2012 17:18:25 GMT | |
Server: Apache | |
Cache-Control: max-age=0, no-cache, no-store, must-revalidate, private | |
Expires: 0 | |
Set-Cookie: qbo.authid=475429715; Domain=.intuit.com; Path=/; Secure; HttpOnly | |
Set-Cookie: qbo.agentid=475429725; Domain=.intuit.com; Path=/; Secure; HttpOnly | |
Set-Cookie: qbo.gauthid=475429725; Domain=.intuit.com; Path=/; Secure; HttpOnly | |
Set-Cookie: qbo.parentid=475430145; Domain=.intuit.com; Path=/; Secure; HttpOnly | |
Set-Cookie: qbo.tkt=V1-93-Q01341595105821ca2a290; Domain=.intuit.com; Path=/; Secure |
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
validates :code_type, inclusion: {in: Proc.new{|s|s.class.code_types.keys}, | |
message: "is undefined", | |
allow_blank: true | |
}, | |
presence: true |