Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!
Want more content like this, for free? Check out my free book, RailsAI!
- Follow me on Twitter for more Ruby AI at https://twitter.com/alexrudall
- Released under the MIT License - use as you wish :)
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") |
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] | |
/Users/your-username/path-your-rails-project/log/*.log your-username:staff 644 4 * $D0 GJ | |
# NOTES | |
# | |
# Place file in /etc/newsyslog.d | |
# '$D0' under 'when' tells newsyslog to rotate logs daily at midnight. | |
# Alternatively you could use '24' for 'when', which would specify "every 24 hours" | |
# '*' under 'size' specifies that logs should be rotated regardless of their size. | |
# 'G' under 'flags' tells newsyslog that the 'logfilename' is a pattern and it should rotate all log files matching the pattern. |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
-
Data Down / Actions Up
- http://emberjs.jsbin.com/nayaho/edit?html,js - Interdependent select boxes. No observers.
- http://ember-twiddle.com/2d7246875098d0dbb4a4 - One Way Input
-
Plain JSBin's
-
Ember Version Base JSBin's
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
Your Class:
class YourClass < ActiveRecord::Base
attr_accessor :some_date
columns_hash["some_date"] = ActiveRecord::ConnectionAdapters::Column.new("some_date", nil, "date")
end
Your View:
<%= form_for :your_class do |f| %>
namespace :db do | |
namespace :enable do | |
desc "enable hstore extension" | |
task :hstore => [:environment, :load_config] do | |
ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS hstore;') | |
end | |
end | |
Rake::Task['db:schema:load'].enhance ['db:enable:hstore'] | |
end |