Skip to content

Instantly share code, notes, and snippets.

View jmercedes's full-sized avatar

Juan jmercedes

View GitHub Profile
@jmercedes
jmercedes / Console
Last active December 10, 2015 05:08
1.9.3-p125 :001 > Refinery::Page.where(view_template: :bio)
Refinery::Page Load (0.4ms) SELECT "refinery_pages".* FROM "refinery_pages" WHERE "refinery_pages"."view_template" = 'bio'
Refinery::Page::Translation Load (0.2ms) SELECT "refinery_page_translations".* FROM "refinery_page_translations" WHERE "refinery_page_translations"."refinery_page_id" = 23
=> [#<Refinery::Page id: 23, parent_id: nil, path: nil, slug: "bio", show_in_menu: true, link_url: "", menu_match: nil, deletable: true, draft: false, skip_to_first_child: false, lft: 35, rgt: 36, depth: 0, view_template: "bio", layout_template: nil, created_at: "2012-12-27 06:51:31", updated_at: "2012-12-27 06:59:12">]
1.9.3-p125 :002 >
@jmercedes
jmercedes / new.html.erb
Last active December 11, 2015 09:58
Generate Vertically-ordered HTML Table
<% @rows_per_column = 18 %>
<% @columns = 7 %>
<table class="table">
<tbody>
<tr>
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<%= simple_form_for [@doctor, @appointment], :html => { :multipart => true, :class => 'form-horizontal' } do |f| %>
<%= f.error_notification %>
<%= f.text_field :adate %>
<%= f.text_field :atime %>
<%= f.file_field :personal_id %>
<%= f.label :insurance_id %><br />
<%= f.file_field :insurance_id %>
<%= f.file_field :prescription %>
<h1><%= @doctor.name %></h1>
<%= simple_form_for([@doctor, @appointment], :html => { :multipart => true, :class => 'form-horizontal' }) do |f| %>
<%= f.error_notification %>
<%= f.input :full_name %>
<%= f.input :email %>
<%= f.input :adate, as: :date_picker %>
<%= f.input :atime, as: :time_picker %>
<%= f.input :personal_id %>
module ApplicationHelper
def sortlist (column, title = nil, filter, css_class)
title ||= column.titleize
css_id = column == :sort_column ? "hilite" : "#{column}_header"
direction = column == :sort_column && :sort_direction == "asc" ? "desc" : "asc"
link_to title, {:sort => column, :direction => direction, :ratings => filter}, {:id => css_id}
end
def th_class (column)
css_class = column == params[:sort] ? "hilite" : nil
@jmercedes
jmercedes / file.html
Created February 8, 2013 21:15
Center image
<div class="center">
<div id="separator"></div>
</div>
@jmercedes
jmercedes / html.html.erb
Created February 11, 2013 17:52
HTML and Rails.
<div class="input-append">
<input id="t2" value="14:30" class="input-small" readonly="" type="text">
<button class="btn" type="button" id="toggle-btn">
<i class="icon-time"></i>
</button>
</div>
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
activerecord:
errors:
models:
appointment:
email:
email_format: "This is not a valid e-mail address"
<%= f.select :atime, @time_options %>
ActiveRecord::StatementInvalid in Refinery::Doctors::Admin::DoctorsController#create
NoMethodError: undefined method `name' for nil:NilClass: INSERT INTO "refinery_doctors" ("bio", "branch", "created_at", "dr_img", "full_name", "location", "name", "position", "prefix", "schedule", "specialty", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)