Skip to content

Instantly share code, notes, and snippets.

@abrambailey
abrambailey / schema.xml
Created May 8, 2013 23:31
Full schema.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<% provide :title, 'Consumer Profile | Update' %>
<legend>Update your Profile</legend>
<%= simple_form_for @consumer, :html => { :class => 'cons_edit form-horizontal' } do |f| %>
<%= f.input :display_name, :label => "Public name", :placeholder => @consumer.user.username %>
<%= f.input :tagline, :placeholder => "Your tagline" %>
1.9.3p286 :001 > @consumer = Consumer.first
Creating scope :page. Overwriting existing method Consumer.page.
Consumer Load (1.3ms) SELECT "consumers".* FROM "consumers" LIMIT 1
=> #<Consumer id: 29, hl: nil, created_at: "2012-10-27 23:27:15", updated_at: "2012-10-27 23:27:15", user_id: 33, display_name: nil, tagline: nil, desc: nil>
1.9.3p286 :002 > @consumer.tags
ActsAsTaggableOn::Tag Load (2.3ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 29 AND "taggings"."taggable_type" = 'Consumer' AND (taggings.context = 'tags')
=> []
1.9.3p286 :003 > @consumer.tag_list
ActsAsTaggableOn::Tag Load (1.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 29 AND "taggings"."taggable_type" = 'Consumer' AND (taggings.context = 'tags' AND taggings.tagger_id IS NULL)
=> []
1.9.3p286 :008 > @consumer = Consumer.first
Consumer Load (0.6ms) SELECT "consumers".* FROM "consumers" LIMIT 1
=> #<Consumer id: 25, hl: nil, created_at: "2012-10-22 19:14:34", updated_at: "2012-10-22 19:14:34", user_id: 29, display_name: nil, tagline: nil, desc: nil>
1.9.3p286 :009 > @consumer.interest_list = "yo, he"
ActsAsTaggableOn::Tag Load (0.8ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 25 AND "taggings"."taggable_type" = 'Consumer' AND (taggings.context = 'interests' AND taggings.tagger_id IS NULL)
=> "yo, he"
1.9.3p286 :010 > @consumer.interest_list
=> ["yo", "he"]
1.9.3p286 :011 > @consumer.save
(0.6ms) BEGIN
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="nav">
%select{:name => "tags", :id=>"tags"}
- @tags.each do |tag|
%option{:value => "ha"} tag
$(document).ready( function () {
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
if ( typeof sNewSource != 'undefined' && sNewSource != null ) {
oSettings.sAjaxSource = sNewSource;
}
// Server-side processing should just call fnDraw
if ( oSettings.oFeatures.bServerSide ) {
def update
@style = Style.find(params[:id])
if @style.update_attributes(params[:style])
redirect_to add_path
else
respond_to do |format|
format.html { render action: "edit" }
format.json { render json: @style.errors, status: :unprocessable_entity }
end
@abrambailey
abrambailey / gist:4174971
Created November 30, 2012 10:20
truncate with full length tooltip
def trunk(input, length, *path)
shorten = truncate(input, :length => length)
if path.empty?
return content_tag(:span, shorten, :rel=>"tooltip", :title=>input)
else
return link_to shorten, path[0], :rel=>"tooltip", :title=>input
end
end
@abrambailey
abrambailey / gist:4175004
Created November 30, 2012 10:23
truncate with full length tooltip
def trunk(input, length, path=nil)
shorten = truncate(input, :length => length)
return link_to shorten, path, :rel=>"tooltip", :title=>input if path
content_tag(:span, shorten, :rel=>"tooltip", :title=>input)
end