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 facebook | |
| if facebook.nil? | |
| FbGraph::User.new('me', :access_token => self.fbauth.token).fetch | |
| else | |
| return facebook | |
| 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
| ActiveAdmin.register Bar do | |
| # controller.load_and_authorize_resource | |
| controller do | |
| load_and_authorize_resource :except => [:update, :index, :show, :edit] | |
| def scoped_collection | |
| end_of_association_chain.accessible_by(current_ability) | |
| 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
| class User < ActiveRecord::Base | |
| attr_accessible :fname, :lname | |
| has_many :parents, :dependent => :destroy | |
| def self.export_to_csv(filename, model, options = {}) | |
| csv_options = {} | |
| csv_options[:col_sep] = options[:separator] || ',' | |
| header = User.header(model,options = {}) | |
| data = User.data(model) |
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
| require 'spec_helper' | |
| describe Import do | |
| TEST_FILENAME = 'test/fixtures/csv/2XU.txt' | |
| ERROR_FILENAME = 'test/fixtures/csv/2XU_errors.txt' | |
| before :all do | |
| HEADER_ROWS = 2 | |
| VARIATION_THEMES = %w(Size Color SizeColor) |
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
| 1.9.3-p392 :060 > Address.all | |
| Address Load (0.4ms) SELECT "addresses".* FROM "addresses" | |
| +----+---------+--------+---------+---------+----------+-------+--------+-------------------------+-------------------------+ | |
| | id | user_id | extra | city | country | postcode | state | street | created_at | updated_at | | |
| +----+---------+--------+---------+---------+----------+-------+--------+-------------------------+-------------------------+ | |
| | 1 | 1 | ankit | asansol | india | 71475 | w.b. | 100 | 2013-06-09 09:22:04 UTC | 2013-06-09 09:22:04 UTC | | |
| | 2 | 1 | sanyam | asansol | india | 71476 | w.b. | 101 | 2013-06-09 09:22:05 UTC | 2013-06-09 09:22:05 UTC | | |
| | 3 | 2 | abhay | asansol | india | 71476 | w.b. | 102 | 2013-06-09 09:22:05 UTC | 2013-06-09 09:22:05 UTC | | |
| | 4 | 3 | abhay | bettiah | india | 71476 | w.b. | 102 | 2013-06-09 09:22:05 UTC | 2013-06-09 09:22:05 UTC | | |
| +----+---------+--------+---------+---------+--- |
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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', '3.2.12' | |
| gem 'arel' | |
| gem 'mysql2' | |
| GEMFILE | |
| system 'bundle' | |
| 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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', '3.2.12' | |
| gem 'arel' | |
| gem 'mysql2' | |
| GEMFILE | |
| system 'bundle' | |
| 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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', '3.2.12' | |
| gem 'arel' | |
| gem 'mysql2' | |
| GEMFILE | |
| system 'bundle' | |
| 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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/codegangsta/martini" // loading in the Martini package | |
| "github.com/martini-contrib/render" | |
| "labix.org/v2/mgo" // loading in the mgo MongoBD driver package | |
| "labix.org/v2/mgo/bson" // loading in the bson package | |
| "net/http" | |
| ) |
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
| package controllers | |
| import ( | |
| "github.com/revel/revel" | |
| "ToGo/app/models" | |
| "ToGo/app/routes" | |
| "github.com/jinzhu/gorm" | |
| type Task struct { | |
| ModelController |
OlderNewer