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
| { | |
| "name": "ember-app", | |
| "dependencies": { | |
| "ember": "emberjs/ember.js#idempotent-rerender", | |
| "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", | |
| "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", | |
| "ember-data": "1.0.0-beta.15", | |
| "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", | |
| "ember-qunit": "0.3.1", | |
| "ember-qunit-notifications": "0.0.7", |
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
| export function initialize(container, application) { | |
| application.deferReadiness(); | |
| Ember.$.getJSON("/api/preload.json", function(json) { | |
| var store = container.lookup('store:main'); | |
| store.load(application.Product, json.products); // undefined is not a function. | |
| application.advanceReadiness(); | |
| }); | |
| } | |
| export default { |
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
| # app/templates/products/index.embl | |
| section.container | |
| h1 Products | |
| ul | |
| each product in products | |
| li = link-to product.name 'products.show' product | |
| = outlet |
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
| // app/initializers/current-user.js | |
| export function initialize(container, application) { | |
| var store = container.lookup('store:main'); | |
| console.log(store); | |
| } | |
| export default { | |
| name: 'current-user', | |
| after: 'preload', |
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
| module Spree | |
| module Api | |
| module V2 | |
| class SessionsController < Spree::UserSessionsController | |
| def create | |
| authenticate_spree_user! | |
| if spree_user_signed_in? | |
| render json: try_spree_current_user, serializer: Spree::UserSerializer | |
| else |
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
| production: | |
| classic: | |
| after_symlink: | |
| - command: cd $STACK_PATH && mkdir -p tmp && mkdir -p tmp/production-class-after-symlink && chmod 777 -R tmp/ | |
| target: rails | |
| apply_during: all | |
| run_on: all_servers | |
| after_rails: | |
| - command: sudo mkdir $STACK_PATH/tmp && sudo mkdir $STACK_PATH/tmp/production-class-after-rails && sudo chmod 0775 -R $STACK_PATH/tmp |
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
| product_filter_copy: ......................................................................................... | |
| product_master: ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. |
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
| # Adding general indexes: | |
| deleted_at = User.arel_table[:deleted_at] | |
| da_is_null = Arel::Nodes::Equality.new(deleted_at, nil).to_sql | |
| # => "\"users\".\"deleted_at\" IS NULL" | |
| remove_index :users, :email | |
| add_index :users, :email, where: da_is_null | |
| # Adding unique indexes: |
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 MyController < BaseController | |
| def index | |
| super MyModel | |
| 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
| ActiveRecord::Base.class_eval do | |
| class << self | |
| delegate :row_to_json, to: :all | |
| end | |
| end | |
| ActiveRecord::Relation.class_eval do | |
| def row_to_json | |
| '[' + row_to_json_result.values.join(',') + ']' | |
| end |