So I built a dummy Rails-plugin gem...
rails plugin new foo --skip-bundle -O --full
and filled in my .gemspec
as below, including the line
s.add_dependency "rails-assets-sugar"
and added
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
# This is the ONLY way I've found that works | |
# All other suggested solutions (see below examples) don't actually work | |
# And as an extra bonus: this deep copies as well! | |
def deep_copy(o) | |
Marshal.load(Marshal.dump(o)) | |
end |
So I built a dummy Rails-plugin gem...
rails plugin new foo --skip-bundle -O --full
and filled in my .gemspec
as below, including the line
s.add_dependency "rails-assets-sugar"
and added
require "mkmf" | |
ext_name = 'my_extension' | |
excluded = ['x86', 'x64'] | |
dir_config(ext_name) | |
$srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) } | |
Dir.glob("#{$srcdir}/*/") do |path| | |
dir = File.basename(path) |
One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks
, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks
.
rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
-d postgresql
sets up the project to use PostgreSQL--skip-turbolinks
& --skip-spring
creates a project that does not use turbolinks or spring-T
skips the creation of the test directory and use of Test::Unit
# /*---------------------------------------------- | |
# Author: SDK Support Group | |
# Company: Paya | |
# Contact: [email protected] | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# !!! Samples intended for educational use only!!! | |
# !!! Not intended for production !!! | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# -----------------------------------------------*/ |
####Rets Rabbit http://www.retsrabbit.com
Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.