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
@brand1 = params[:brand][:name] | |
@model = params[:brand][:models_attributes]["0"]["name"] | |
@submodel = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["name"] | |
@style = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["styles_attributes"]["0"]["name"] | |
a = Brand.find_or_create_by_name(@brand1) | |
b = Model.find_or_create_by_name(@model, :brand_id => a.id) | |
c = Submodel.find_or_create_by_name(@submodel, :model_id => b.id) | |
d = Style.new(:name => @style, :submodel_id => c.id) | |
d.save |
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
@brand1 = params[:brand][:name] | |
@model = params[:brand][:models_attributes]["0"]["name"] | |
@submodel = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["name"] | |
@style = params[:brand][:models_attributes]["0"]["submodels_attributes"]["0"]["styles_attributes"]["0"]["name"] | |
a = Brand.find_or_create_by_name(@brand1) | |
b = Model.find_or_create_by_name(@model, :brand_id => a.id) | |
c = Submodel.find_or_create_by_name(@submodel, :model_id => b.id) | |
d = Style.new(:name => @style, :submodel_id => c.id) | |
d.save |
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
models/product.rb | |
def category_name category.try(:name) end def category_name=(name) self.category = Category.find_or_create_by_name(name) if name.present? end def category_name | |
category.try(:name) | |
end | |
def category_name=(name) | |
self.category = Category.find_or_create_by_name(name) if name.present? | |
endapp/assets/javascripts/application.js | |
//= require jquery-ui //= require jquery-uiapp/assets/javascripts/products.js.coffee | |
jQuery -> $('#product_category_name').autocomplete source: $('#product_category_name').data('autocomplete-source') jQuery -> |
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
models/product.rb | |
def category_name category.try(:name) end def category_name=(name) self.category = Category.find_or_create_by_name(name) if name.present? end def category_name | |
category.try(:name) | |
end | |
def category_name=(name) | |
self.category = Category.find_or_create_by_name(name) if name.present? | |
endapp/assets/javascripts/application.js |
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 Comment < ActiveRecord::Base | |
belongs_to :commentable, :polymorphic => true | |
belongs_to :user | |
attr_accessible :body, :user | |
validates_length_of :body, :minimum => 1 | |
validates_presence_of :user | |
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
f.series(:data => @values, :dataLabels => { :formatter => %|function() { return this.x; }|.js_code, :enabled => true, :rotation => 90, :x=>-3, :y=>15, :color=>"#FFFFFF" } ) |
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
(function(){function E(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function ja(){for(var a=0,b=arguments,c=b.length,d={};a<c;a++)d[b[a++]]=b[a];return d}function N(a,b){return parseInt(a,b||10)}function zb(a){return typeof a==="string"}function rb(a){return typeof a==="object"}function ic(a){return Object.prototype.toString.call(a)==="[object Array]"}function Sb(a){return typeof a==="number"}function Eb(a){return sa.log(a)/sa.LN10}function rc(a){return sa.pow(10,a)}function Fb(a,b){for(var c= | |
a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function A(a){return a!==G&&a!==null}function R(a,b,c){var d,e;if(zb(b))A(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(A(b)&&rb(b))for(d in b)a.setAttribute(d,b[d]);return e}function sb(a){return ic(a)?a:[a]}function r(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],typeof c!=="undefined"&&c!==null)return c}function J(a,b){if(Tb&&b&&b.opacity!==G)b.filter="alpha(opacity="+b.opacity*100+")";E(a.style,b)}function na(a, | |
b,c,d,e){a=S |
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
<script type="text/javascript"> | |
(function() { | |
var onload = window.onload; | |
window.onload = function(){ | |
if (typeof onload == "function") onload(); | |
var options, chart; | |
options = { "title": { "text": "Top Brands by Score" },"legend": { "layout": "vertical","style": { },"enabled": false },"xAxis": { "categories": ["x","y","z"] },"yAxis": { "title": { "text": null },"labels": { } },"tooltip": { "enabled": true,"formatter": function() { return '<b>'+ this.x +'</b>: '+ this.y.toFixed(1) +' %'; } },"credits": { "enabled": false },"plotOptions": { "areaspline": { } },"chart": { "defaultSeriesType": "column","renderTo": "my_id","height": 230,"width": 200,"backgroundColor": "#F0F0F0" },"subtitle": { },"series": [{"data":[77.5,67.0,55.0],"dataLabels":{"formatter":"function() { return this.x; }","enabled":true,"rotation":90,"x":-3,"y":15,"color":"#FFFFFF"},"name":null}] }; | |
chart = new Highcharts.Chart(options); | |
}; |
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
/* line 26, ../../../../.rvm/gems/ruby-1.9.3-p286@goodsounds/gems/bootstrap-sass-2.1.1.0/vendor/assets/stylesheets/bootstrap/_mixins.scss */ | |
.clearfix { | |
*zoom: 1; | |
} | |
/* line 15, ../../../../.rvm/gems/ruby-1.9.3-p286@goodsounds/gems/bootstrap-sass-2.1.1.0/vendor/assets/stylesheets/bootstrap/_mixins.scss */ | |
.clearfix:before, .clearfix:after { | |
display: table; | |
content: ""; | |
line-height: 0; | |
} |
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 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 |
OlderNewer