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
| RSpec.describe "BillingAddresses", type: :request do | |
| describe "GET /billing_address/:id" do | |
| let (:billing_address) { create(:billing_address, user_id: 123) } | |
| it "returns http success" do | |
| get "/billing_address/#{billing_address.id}" | |
| expect(response).to have_http_status(:success) | |
| 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
| # /config/environments/test.rb | |
| Rails.application.configure do | |
| # ... | |
| # Disable the need to have a record on the other end of an association | |
| config.active_record.belongs_to_required_by_default = false | |
| # ... | |
| 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 BillingAddress < ApplicationRecord | |
| belongs_to :user, optional: true | |
| 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
| RSpec.describe "BillingAddresses", type: :request do | |
| describe "GET /billing_address/:id" do | |
| let (:billing_address) { build(:billing_address, id: 123, user_id: 500) } | |
| it "returns http success" do | |
| allow(BillingAddress) | |
| .to receive(:find) | |
| .and_return(billing_address) | |
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
| RSpec.describe "BillingAddresses", type: :request do | |
| describe "GET /billing_address/:id" do | |
| let (:billing_address) { create(:billing_address, user: user) } | |
| let (:user) { create(:user, user_group: user_group) } | |
| let (:user_group) { create(:user_group, company: company) } | |
| let (:company) { create(:company) } | |
| it "returns http success" do | |
| get "/billing_address/#{billing_address.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
| # == Schema Information | |
| # | |
| # Table name: billing_addresses | |
| # | |
| # id :integer not null, primary key | |
| # user_id :integer not null | |
| # | |
| class BillingAddress < ApplicationRecord | |
| belongs_to :user | |
| 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 TurboDeviseController < ApplicationController | |
| class Responder < ActionController::Responder | |
| def to_turbo_stream | |
| controller.render(options.merge(formats: :html)) | |
| rescue ActionView::MissingTemplate => error | |
| if get? | |
| raise error | |
| elsif has_errors? && default_action | |
| render rendering_options.merge(formats: :html, status: :unprocessable_entity) | |
| else |
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
| # app/controllers/turbo_devise_controller.rb | |
| class TurboDeviseController < ApplicationController | |
| class Responder < ActionController::Responder | |
| def to_turbo_stream | |
| controller.render(options.merge(formats: :html)) | |
| rescue ActionView::MissingTemplate => error | |
| if get? | |
| raise error | |
| elsif has_errors? && default_action |
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
| # /config/initializers/devise.rb | |
| # Turbo doesn't work with devise by default. | |
| # Keep tabs on https://github.com/heartcombo/devise/issues/5446 for a possible fix | |
| # Fix from https://gorails.com/episodes/devise-hotwire-turbo | |
| class TurboFailureApp < Devise::FailureApp | |
| def respond | |
| if request_format == :turbo_stream | |
| redirect | |
| else |
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
| public class Receiver : MonoBehaviour { | |
| public Camera receiverCamera; | |
| public GameObject[] listeners; | |
| public void SendCommand(string cmd, object val = null) { | |
| foreach (GameObject listener in listeners) { | |
| listener.SendMessage(cmd, val, SendMessageOptions.DontRequireReceiver); | |
| }; | |
| } | |
| } |