Skip to content

Instantly share code, notes, and snippets.

@iannono
Last active August 29, 2015 14:08
Show Gist options
  • Save iannono/72688d78538f554b6b68 to your computer and use it in GitHub Desktop.
Save iannono/72688d78538f554b6b68 to your computer and use it in GitHub Desktop.
env:== rails
** devise **
https://github.com/plataformatec/devise
rails generate devise:install
rails generate devise MODEL
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
before_action :authenticate_user!
rails generate devise:views users
rails generate devise:controllers [scope]
devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 20
** bootstrap **
https://github.com/twbs/bootstrap-sass
gem 'bootstrap-sass', '~> 3.3.0'
gem 'autoprefixer-rails'
@import "bootstrap-sprockets";
@import "bootstrap";
//= require jquery
//= require bootstrap-sprockets
** paper clipper **
def self.up
add_attachment :users, :avatar
end
def self.down
remove_attachment :users, :avatar
end
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
RAILS_ENV=production rake db:setup
# produces the error below.....hmmm.....it's a no-worky
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory
# hstore postgresql extension needs to be installed, so....
sudo apt-get install postgresql-contrib
# now your extension should be available to enable so log in with psql
psql -d yourproject_production -U yourdbuser -W
# in the psql shell
CREATE EXTENSION hstore;
\q
# now you're golden, may need to clean up and re-run
RAILS_ENV=production rake db:drop
RAILS_ENV=production rake db:setup
heroic run rake db:migrate -a chideo-test01
heroku pg:reset DATABASE_URL --confirm chideo-test01
** download jruby **
wget https://s3.amazonaws.com/jruby.org/downloads/1.7.16.1/jruby-bin-1.7.16.1.tar.gz
** download jdk **
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz"
** install jdk **
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
** postgresql **
sudo -u postgres psql template1
** question **
--for disable jce
java.lang.Class.for_name('javax.crypto.JceSecurity').get_declared_field('isRestricted').tap{|f| f.accessible = true; f.set nil, false}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment