Skip to content

Instantly share code, notes, and snippets.

View radar's full-sized avatar

Ryan Bigg radar

View GitHub Profile
View gist:1593
class Rating < ActiveRecord::Base
belongs_to :thing, :polymorphic => true
end
class Comment < ActiveRecord::Base
has_many :ratings
end
View gist:8725748
.0/lib/ruby/2.1.0/bigdecimal/util.rb:18: [BUG] Segmentation fault at 0x00000000000000
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
View helper.rb
def more_products_link
object = @store || @tag || @collection
link_to 'Load More Products', [object, :view], :class => 'load-more-products', :remote => true if @products.next_page
end
View gist:8820710
[4] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> response.error
=> [:base, "Transaction was refused."]
[5] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> response.refusal_reason
=> "Refused"
View taxons_controller_decorator.rb
Spree::TaxonsController.class_eval do
def show
@taxon = Taxon.find_by_permalink!(params[:id])
return unless @taxon
@searcher = build_searcher(params.merge(:taxon => @taxon.id))
@products = @searcher.retrieve_products.descend_by_master_price
end
end
View products.json
{
products: [
{
name: 'Foo',
option_type_ids: [1,2,3]
}
],
option_types: [
{ id: 1, name: 'Bar' },
{ id: 2, name: 'Baz' },
View gist:8986402
spree (fcfc846...)⸘ git tag --contains 5fa46a5a3f30c14c1f464266234337411136aafd
v2.0.5
v2.0.6
v2.0.7
v2.0.8
View gist:9179382
respond_to do |format|
format.all { render :json => thing }
end
View gist:9254567
Jbuilder.encode do |json|
json.array! @products do |product|
json.name product.name
View spree.js.coffee
//= require jquery
//= require handlebars
//= require ember
//= require ember-data
//= require spree
Spree.App = Ember.Application.create()
DS.RESTAdapter.reopen
namespace: 'api'