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
[5] pry(main)> receipt_number = receipt["Reference Number(s)"] | |
=> "121961|501526|121961|501526" | |
[6] pry(main)> receipt_number = receipt["Reference Number(s)"].match(/"\K\d+/) | |
=> nil | |
https://rubular.com/r/ML1ypdresB9CKY |
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
object(Ups\Exception\InvalidResponseException)#20 (7) { ["message":protected]=> string(175) "Failure: The user has been blocked from downloading subscription files because of the following inactive status(es): CompanyQVD, UserQVD, CompanyInbound, UserInbound. (330052)" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(95) "/Users/pdgcreative/Projects/blue-sky-bio/public_html/vendor/gabrielbull/ups-api/src/Request.php" ["line":protected]=> int(144) ["trace":"Exception":private]=> array(2) { [0]=> array(6) { ["file"]=> string(99) "/Users/pdgcreative/Projects/blue-sky-bio/public_html/vendor/gabrielbull/ups-api/src/QuantumView.php" ["line"]=> int(109) ["function"]=> string(7) "request" ["class"]=> string(11) "Ups\Request" ["type"]=> string(2) "->" ["args"]=> array(3) { [0]=> string(194) " foo bar biz " [1]=> string(369) " 20190906152737 20190906162737 QVEvents " [2]=> string(48) "https://onlinetools.ups.com/ups.app/xml/QVEvents" } } [1]=> array(6) { ["file"]=> s |
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
@count = @entries.map(&:type).each_with_object(Hash.new(0)) { |type, hash| hash[type] += 1 } | |
=> | |
{ | |
#<Type:0x00007fd3a9a4f810 id: 4, title: "Events", created_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, updated_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, slug: "events">=>2, | |
#<Type:0x00007fd3a38f6cd0 id: 10, title: "Topic", created_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, updated_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, slug: "topic">=>1, | |
#<Type:0x00007fd3a7b2f4e0 id: 5, title: "Restaurants", created_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, updated_at: Mon, 19 Aug 2019 18:22:02 UTC +00:00, slug: "restaurants">=>2, | |
} | |
How can I remove any Type that has title of Topic ? |
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
- @entries.each do |entry| | |
.row.topics-show | |
.col-sm-12.col-md-5.text-left.mt-3 | |
= link_to cities_and_lake_path(entry), class: 'no-underline' do | |
= feature_image_present?(entry.featured_image) | |
.col-sm-12.col-md-7 | |
= link_to cities_and_lake_path(entry), class: 'no-underline' do | |
%h3.color-green.mt-3 | |
= entry.title |
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
@events = @entry.related_events | |
scope :related_events, -> { joins(:related_entries).where(type_id: 4) | |
has_and_belongs_to_many :related_entries, | |
class_name: "Entry", | |
join_table: "related_entries", | |
association_foreign_key: "other_entry_id" | |
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 'selenium-webdriver' | |
require 'nokogiri' | |
require 'capybara' | |
require 'curb' | |
require 'json' | |
require 'pry' | |
require 'logger' | |
log = Logger.new('log.txt') | |
log.level = Logger::WARN |
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
= check_box_tag 'entry[related_entry_ids][]', entry.id, entry.id.in?(entry.related_entries) | |
= check_box_tag 'entry[related_entry_ids][]', entry, entry.related_entries.include?(entry) | |
e.related_entries.map(&:id) | |
Entry Load (0.5ms) SELECT "entries".* FROM "entries" INNER JOIN "related_entries" ON "entries"."id" = "related_entries"."other_entry_id" WHERE "related_entries"."entry_id" = $1 [["entry_id", 5]] | |
=> [1, 7, 6] | |
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
e = Entry.last | |
e.related_entries | |
Entry Load (0.7ms) SELECT "entries".* FROM "entries" INNER JOIN "related_entries" ON "entries"."id" = "related_entries"."other_entry_id" WHERE "related_entries"."entry_id" = $1 LIMIT $2 [["entry_id", 7], ["LIMIT", 11]] | |
=> #<ActiveRecord::Associations::CollectionProxy []> | |
f = Entry.first | |
e.related_entries << f | |
(0.4ms) BEGIN | |
Entry::HABTM_RelatedEntries Create (0.7ms) INSERT INTO "related_entries" ("entry_id", "other_entry_id") VALUES ($1, $2) RETURNING "id" [["entry_id", 7], ["other_entry_id", 1]] |
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
Traceback (most recent call last): | |
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "entries_entries" does not exist) | |
LINE 8: WHERE a.attrelid = '"entries_entries"'::regcl... | |
^ | |
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), | |
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, | |
c.collname, col_description(a.attrelid, a.attnum) AS comment | |
FROM pg_attribute a | |
LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum | |
LEFT JOIN pg_type t ON a.atttypid = t.oid |
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
$("select#entry_type_id").on('change', function(){ | |
if ( ["10", "9"].includes($("#entry_type_id")).val() ) { | |
$("#profile-tab").parent().hide(); | |
$("#add-topic").hide(); | |
} else { | |
$("#profile-tab").parent().show(); | |
$("#add-topic").show(); | |
} | |
}) |