<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: donnellycarroll</title>
    <description>The latest articles on DEV Community by donnellycarroll (@donnellycarroll).</description>
    <link>https://dev.to/donnellycarroll</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2979683%2F90c151ca-1d2e-44ee-8fb5-f7ee548a31b6.png</url>
      <title>DEV Community: donnellycarroll</title>
      <link>https://dev.to/donnellycarroll</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/donnellycarroll"/>
    <language>en</language>
    <item>
      <title>coding agent</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Thu, 22 May 2025 17:49:34 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/coding-agent-3j6j</link>
      <guid>https://dev.to/donnellycarroll/coding-agent-3j6j</guid>
      <description>&lt;p&gt;&lt;a href="https://radanskoric.com/articles/coding-agent-in-ruby" rel="noopener noreferrer"&gt;https://radanskoric.com/articles/coding-agent-in-ruby&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;need to manually load gem files in terminal &lt;code&gt;gem install dotenv&lt;/code&gt; when running ruby (not rails) files&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>programming</category>
      <category>installation</category>
    </item>
    <item>
      <title>Capstone notes p2</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Thu, 22 May 2025 00:56:42 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/capstone-notes-p2-42cn</link>
      <guid>https://dev.to/donnellycarroll/capstone-notes-p2-42cn</guid>
      <description>&lt;p&gt;Writing sample data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;started with small amount from Study Buddy - need to follow "Contact Book - Our Very First Database" from AppDev1 section "custom rake tasks"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Association Accessors:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Direct Associations: &lt;code&gt;belongs_to&lt;/code&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
In standard Rails applications, the &lt;strong&gt;default&lt;/strong&gt; is opposite: &lt;code&gt;belongs_to adds&lt;/code&gt; an &lt;u&gt;automatic validation&lt;/u&gt; to foreign key columns enforcing the presence of a valid value unless you &lt;em&gt;explicitly&lt;/em&gt; add the option &lt;code&gt;optional: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So: if you decided to remove the &lt;code&gt;null: false&lt;/code&gt; database constraint from any of your foreign key columns in the migration file (e.g., change &lt;code&gt;t.references :recipient&lt;/code&gt;, &lt;code&gt;null: false ...&lt;/code&gt; to &lt;code&gt;t.references :recipient, null: true ...&lt;/code&gt;), then you should also add the &lt;code&gt;optional: true&lt;/code&gt; option to the corresponding &lt;code&gt;belongs_to&lt;/code&gt; association accessor.&lt;/p&gt;

&lt;p&gt;So remember — if you’re ever in the situation of:    &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you’re trying to save a record&lt;/li&gt;
&lt;li&gt;the save is failing&lt;/li&gt;
&lt;li&gt;you’re doing the standard debugging technique of printing out &lt;code&gt;zebra.errors.full_messages&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;you’re seeing an inexplicable validation error message saying that a foreign key column is blank&lt;/li&gt;
&lt;li&gt;now you know where the validation is coming from: &lt;code&gt;belongs_to&lt;/code&gt; adds it automatically&lt;/li&gt;
&lt;li&gt;so figure out why you’re not providing a valid foreign key (usually it is because the parent object failed to save for its own validation reasons)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Direct associations: &lt;code&gt;has_many&lt;/code&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Each &lt;code&gt;belongs_to&lt;/code&gt;, there should be an inverse &lt;code&gt;has_many&lt;/code&gt;. Check to make sure you have all of these inverse 1-N associations.&lt;/p&gt;

&lt;p&gt;attendee ~ fan &lt;br&gt;
leaders = who a user is following&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Capstone notes</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Wed, 21 May 2025 23:49:58 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/capstone-notes-pia</link>
      <guid>https://dev.to/donnellycarroll/capstone-notes-pia</guid>
      <description>&lt;p&gt;Writing sample data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;started with small amount from Study Buddy - need to follow "Contact Book - Our Very First Database" from AppDev1 section "custom rake tasks"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Association Accessors:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Direct Associations: &lt;code&gt;belongs_to&lt;/code&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
In standard Rails applications, the &lt;strong&gt;default&lt;/strong&gt; is opposite: &lt;code&gt;belongs_to adds&lt;/code&gt; an &lt;u&gt;automatic validation&lt;/u&gt; to foreign key columns enforcing the presence of a valid value unless you &lt;em&gt;explicitly&lt;/em&gt; add the option &lt;code&gt;optional: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So: if you decided to remove the &lt;code&gt;null: false&lt;/code&gt; database constraint from any of your foreign key columns in the migration file (e.g., change &lt;code&gt;t.references :recipient&lt;/code&gt;, &lt;code&gt;null: false ...&lt;/code&gt; to &lt;code&gt;t.references :recipient, null: true ...&lt;/code&gt;), then you should also add the &lt;code&gt;optional: true&lt;/code&gt; option to the corresponding &lt;code&gt;belongs_to&lt;/code&gt; association accessor.&lt;/p&gt;

&lt;p&gt;So remember — if you’re ever in the situation of:    &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you’re trying to save a record&lt;/li&gt;
&lt;li&gt;the save is failing&lt;/li&gt;
&lt;li&gt;you’re doing the standard debugging technique of printing out &lt;code&gt;zebra.errors.full_messages&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;you’re seeing an inexplicable validation error message saying that a foreign key column is blank&lt;/li&gt;
&lt;li&gt;now you know where the validation is coming from: &lt;code&gt;belongs_to&lt;/code&gt; adds it automatically&lt;/li&gt;
&lt;li&gt;so figure out why you’re not providing a valid foreign key (usually it is because the parent object failed to save for its own validation reasons)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Direct associations: &lt;code&gt;has_many&lt;/code&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Each &lt;code&gt;belongs_to&lt;/code&gt;, there should be an inverse &lt;code&gt;has_many&lt;/code&gt;. Check to make sure you have all of these inverse 1-N associations.&lt;/p&gt;

&lt;p&gt;attendee ~ fan &lt;br&gt;
leaders = who a user is following&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Capstone process outline</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Sun, 11 May 2025 22:31:47 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/capstone-process-outline-42mg</link>
      <guid>https://dev.to/donnellycarroll/capstone-process-outline-42mg</guid>
      <description>&lt;ol&gt;
&lt;li&gt;ERD (Entity Relationship Diagrams) using Ideas&lt;/li&gt;
&lt;li&gt;Generate resources w/ scaffolds
a. &lt;code&gt;rails g resource : scaffold...&lt;/code&gt;
b. &lt;code&gt;rake db migrate&lt;/code&gt;
then RCAV Route, Controller, Action, View&lt;/li&gt;
&lt;li&gt;generate &lt;strong&gt;user accounts with Devis&lt;/strong&gt;e&lt;/li&gt;
&lt;li&gt;add &lt;code&gt;gem devise&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bundle install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rails g devise:install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;add root route in &lt;code&gt;routes.rb&lt;/code&gt; i.e. &lt;code&gt;root "photos#index"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;generate &lt;code&gt;users&lt;/code&gt; table &lt;code&gt;rails g devise user username name ....&lt;/code&gt; from copilot on Ideas&lt;/li&gt;
&lt;li&gt;look at migration file &amp;amp; make edits (i.e. to default values)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rake db:migrate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generate photos/events resources&lt;/strong&gt; with scaffold &lt;code&gt;rails g scaffold event...&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;check migration file (i.e. &lt;code&gt;t.references&lt;/code&gt; and default values for &lt;code&gt;t.integrer :likes_count, default: 0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check association accessor with correct foreign key column names if applicable &lt;/li&gt;
&lt;li&gt;update migration file to point the foreign key to the correct table i.e. &lt;code&gt;t.references :owner, null: false, foreign_key: { to_table: :users }&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rake db:migrate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;generate other tables (i.e. comments)&lt;/li&gt;
&lt;li&gt;check migration file &lt;/li&gt;
&lt;li&gt;check models i.e. &lt;code&gt;comment.rb&lt;/code&gt; and &lt;code&gt;user.rb&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;use Association Accessor app to plan out association accessor methods &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Associations&lt;br&gt;
Direct associations: &lt;code&gt;belongs_to&lt;/code&gt; &amp;amp; &lt;code&gt;has_many&lt;/code&gt; etc. check Ideas copilot &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Indirect Associations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;look at study buddy answer to second degree associations question &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Validations&lt;br&gt;
Sample Data&lt;/p&gt;

&lt;p&gt;PART 2 - user interface - use ajax here&lt;/p&gt;

&lt;p&gt;7 golden actions (autogenerated using &lt;code&gt;resources :movies&lt;/code&gt; in &lt;code&gt;routes.rb&lt;/code&gt; (create, new, index, show, update, edit, destroy)&lt;/p&gt;

&lt;p&gt;View templates&lt;br&gt;
Partials: &lt;code&gt;_form.html.erb&lt;/code&gt; &lt;code&gt;_navbar.html.erb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Bootstrap cards&lt;br&gt;
partials i.e. &lt;code&gt;_movie.html.erb&lt;/code&gt;&lt;br&gt;
method: &lt;code&gt;.to_partial_path&lt;/code&gt; inherited from &lt;code&gt;ApplicationRecord&lt;/code&gt;class&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Bridges</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Wed, 07 May 2025 23:04:28 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/bridges-3i83</link>
      <guid>https://dev.to/donnellycarroll/bridges-3i83</guid>
      <description>&lt;p&gt;Native - &lt;br&gt;
Bridge components:&lt;br&gt;
3 building blocks &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML markup - where your server configures the component&lt;/li&gt;
&lt;li&gt;The Stimulus controller subclass - where messages are passed between web and native&lt;/li&gt;
&lt;li&gt;The native component - where Swift generates the UI and interacts with native APIs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Build new bridge: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the HTML markup
use double dashes -- when referencing Stimulus controller --&amp;gt; allows us to namespace our bridge component controllers under the &lt;code&gt;bridge/&lt;/code&gt;
directory, keeping them separate from traditional Stimulus controllers.&lt;/li&gt;
&lt;li&gt;Create a Stimulus controller&lt;/li&gt;
&lt;li&gt;Create a native component&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Respond to Button Taps&lt;br&gt;
On the web, we used &lt;code&gt;send()&lt;/code&gt; to pass a message &lt;em&gt;to&lt;/em&gt; native code. To pass a message _from _ native code to the web we have &lt;code&gt;reply(to:)&lt;/code&gt;. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>xcode</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Thu, 01 May 2025 01:31:32 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/xcode-bja</link>
      <guid>https://dev.to/donnellycarroll/xcode-bja</guid>
      <description>&lt;p&gt;Canvas editor showing SwiftUI: cmd + opt + enter&lt;/p&gt;

&lt;p&gt;In the simulator, you can hold down the options key to create a second “finger”, which is useful for zooming in and out on the map. You can then hold down shift to “stick” them together for two-finger&lt;br&gt;
scrolls.&lt;/p&gt;

&lt;p&gt;stopped on page 114&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>swift</category>
      <category>ios</category>
      <category>mobile</category>
    </item>
    <item>
      <title>stimulus</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Thu, 01 May 2025 00:00:26 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/stimulus-249d</link>
      <guid>https://dev.to/donnellycarroll/stimulus-249d</guid>
      <description>&lt;p&gt;To view the browser console log, open the browser console by pressing &lt;code&gt;Ctrl + Shift + J&lt;/code&gt; on Windows or &lt;code&gt;Cmd + Option + J&lt;/code&gt; on a Mac&lt;/p&gt;

&lt;p&gt;Let’s review the steps for setting up toasts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User submits comment form (via Turbo).&lt;/li&gt;
&lt;li&gt;Rails controller saves comment, sets &lt;code&gt;flash[:notice]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Rails renders &lt;code&gt;create.turbo_stream.erb&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;turbo_stream.append&lt;/code&gt; renders the &lt;code&gt;_toast.html.erb&lt;/code&gt; partial with the flash message&lt;/li&gt;
&lt;li&gt;The browser receives the Turbo Stream response.&lt;/li&gt;
&lt;li&gt;Turbo appends the new toast HTML (containing &lt;code&gt;data-controller="toast"&lt;/code&gt;) into the &lt;code&gt;&amp;lt;div id="toasts"&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Stimulus sees the new &lt;code&gt;data-controller="toast"&lt;/code&gt; element&lt;/li&gt;
&lt;li&gt;Stimulus initializes a new &lt;code&gt;ToastController&lt;/code&gt; instance for this element&lt;/li&gt;
&lt;li&gt;The controller’s &lt;code&gt;connect()&lt;/code&gt; method runs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;connect()&lt;/code&gt; uses Bootstrap to &lt;code&gt;show()&lt;/code&gt; the toast&lt;/li&gt;
&lt;li&gt;Bootstrap automatically hides the toast after 3 seconds&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>mac shortcuts</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Wed, 30 Apr 2025 23:33:56 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/mac-shortcuts-5h53</link>
      <guid>https://dev.to/donnellycarroll/mac-shortcuts-5h53</guid>
      <description>&lt;p&gt;cmd + opt + ctrl + L arrow --&amp;gt; send window to different display&lt;/p&gt;

&lt;p&gt;F6 --&amp;gt; next display&lt;br&gt;
F5 --&amp;gt; previous display&lt;br&gt;
F3 --&amp;gt; left half&lt;br&gt;
F4 --&amp;gt; right half &lt;/p&gt;

&lt;p&gt;cmd + space bar --&amp;gt; spotlight &lt;br&gt;
cmd + w --&amp;gt; close tab&lt;br&gt;
cmd + t --&amp;gt; new tab&lt;br&gt;
cmd + n --&amp;gt; new window&lt;br&gt;
cmd + m --&amp;gt; minimize window &lt;/p&gt;

&lt;p&gt;cmd + tab --&amp;gt; switch application &lt;br&gt;
cmd + ` --&amp;gt; switch window&lt;/p&gt;

&lt;p&gt;ctrl + tab --&amp;gt; switch tabs &lt;/p&gt;

&lt;p&gt;ctrl + cmd + shift + L arrow --&amp;gt; lower left &lt;br&gt;
ctrl + cmd + L arrow --&amp;gt; upper left &lt;br&gt;
options + cmd + c --&amp;gt; center&lt;/p&gt;

&lt;p&gt;ctrl + i --&amp;gt; align text (in xcode)&lt;/p&gt;

&lt;p&gt;q for ben&lt;br&gt;
align text in codespaces? on mac&lt;br&gt;
apply for a developer account?&lt;br&gt;
why does tunnel auto reload?&lt;br&gt;
can't submit forms - don't auto route? or just very slow?&lt;br&gt;
can i unlock app dev 1 plz without redoing &lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>mac shortcuts</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Wed, 30 Apr 2025 00:08:09 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/mac-shortcuts-2i5f</link>
      <guid>https://dev.to/donnellycarroll/mac-shortcuts-2i5f</guid>
      <description>&lt;p&gt;cmd + opt + ctrl + L arrow --&amp;gt; send window to different display&lt;/p&gt;

&lt;p&gt;F6 --&amp;gt; next display&lt;br&gt;
F5 --&amp;gt; previous display&lt;br&gt;
F3 --&amp;gt; left half&lt;br&gt;
F4 --&amp;gt; right half &lt;/p&gt;

&lt;p&gt;cmd + space bar --&amp;gt; spotlight &lt;br&gt;
cmd + w --&amp;gt; close tab&lt;br&gt;
cmd + t --&amp;gt; new tab&lt;br&gt;
cmd + n --&amp;gt; new window&lt;br&gt;
cmd + m --&amp;gt; minimize window &lt;/p&gt;

&lt;p&gt;cmd + tab --&amp;gt; switch application &lt;br&gt;
cmd + ` --&amp;gt; switch window&lt;/p&gt;

&lt;p&gt;ctrl + tab --&amp;gt; switch tabs &lt;/p&gt;

&lt;p&gt;ctrl + cmd + shift + L arrow --&amp;gt; lower left &lt;br&gt;
ctrl + cmd + L arrow --&amp;gt; upper left &lt;br&gt;
options + cmd + c --&amp;gt; center&lt;/p&gt;

&lt;p&gt;ctrl + i --&amp;gt; align text (in xcode)&lt;/p&gt;

&lt;p&gt;q for ben&lt;br&gt;
align text in codespaces? on mac&lt;br&gt;
apply for a developer account?&lt;br&gt;
why does tunnel auto reload?&lt;br&gt;
can't submit forms - don't auto route? or just very slow?&lt;br&gt;
can i unlock app dev 1 plz without redoing &lt;/p&gt;

</description>
      <category>productivity</category>
      <category>software</category>
      <category>developer</category>
    </item>
    <item>
      <title>ajax to turbostream</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Sun, 20 Apr 2025 23:00:03 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/ajax-to-turbostream-3076</link>
      <guid>https://dev.to/donnellycarroll/ajax-to-turbostream-3076</guid>
      <description>&lt;p&gt;you can run &lt;code&gt;rails sample_data&lt;/code&gt; then &lt;code&gt;bin/dev&lt;/code&gt;&lt;br&gt;
CRUD stands for Create, Read, Update, and Delete&lt;/p&gt;

&lt;p&gt;AJAXIFYING&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When the edit icon is clicked, let’s replace the comment with an edit form, right in place.&lt;/li&gt;
&lt;li&gt;When that form is submitted, let’s replace it with the updated comment, right in place.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For each action, you should follow the standard Ajaxification steps:&lt;/p&gt;

&lt;p&gt;Switch the link/form from HTML to JS with &lt;code&gt;remote: true&lt;/code&gt; and (&lt;code&gt;method: :delete&lt;/code&gt; if it is a DELETE request) on &lt;code&gt;link_to&lt;/code&gt; or &lt;code&gt;button_to&lt;/code&gt;, or &lt;code&gt;local: false&lt;/code&gt; on &lt;code&gt;form_with&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add &lt;code&gt;format.js&lt;/code&gt; to the appropriate &lt;code&gt;respond_to&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;Write a JS response template. This will usually involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using or creating partials to represent the components being rendered via Ajax.&lt;/li&gt;
&lt;li&gt;Adding top-level elements with id="" attributes to the partials, if they don’t already have them.
&lt;/li&gt;
&lt;li&gt;Writing some jQuery to select an existing element in the DOM and insert near it, replace it, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Turbo_Stream&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;change controller to respond to &lt;code&gt;turbo_stream&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;update partial/s&lt;/li&gt;
&lt;li&gt;update view templates &lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Java notes</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Wed, 16 Apr 2025 23:03:07 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/java-notes-2dk9</link>
      <guid>https://dev.to/donnellycarroll/java-notes-2dk9</guid>
      <description>&lt;p&gt;use &lt;code&gt;let&lt;/code&gt; when creating variables for the first time&lt;/p&gt;

&lt;p&gt;use &lt;code&gt;const&lt;/code&gt; to declare a constant (unlike all caps in ruby) - can't redefine/replace value of constant in JS&lt;/p&gt;

&lt;p&gt;lowerCamelCase i.e. iPhone&lt;/p&gt;

&lt;p&gt;increment a value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let x = 5;
x++;
#x is now 6 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods that accept code: in JavaScript, these are called “anonymous functions” rather than “blocks”. &lt;br&gt;
If the method provides values for block variables, in Ruby we name them within optional “pipes” &lt;code&gt;| |&lt;/code&gt; after the &lt;code&gt;do&lt;/code&gt;. In JavaScript, we name them within the parentheses &lt;code&gt;( )&lt;/code&gt; (which are not optional) after &lt;code&gt;function&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;JS comparisons use triple &lt;code&gt;===&lt;/code&gt;, not double &lt;code&gt;==&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Beware: There’s also a JS double &lt;code&gt;==&lt;/code&gt; (non-strict equivalence) operator. In most cases, you should use &lt;code&gt;===&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;jQuery()&lt;/code&gt; alias &lt;code&gt;$()&lt;/code&gt; for shorthand&lt;/p&gt;

&lt;p&gt;In JavaScript, you have to execute the function explicitly by adding the parentheses, even if there are no arguments. ie &lt;code&gt;chi.text()&lt;/code&gt; not &lt;code&gt;chi.text&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Any CSS property/value pair can be set with the &lt;code&gt;css()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;Event handlers with on()&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$("body").on("click", "#bye", function() {
  $(".west").slideToggle();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is saying: “Within &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;, find elements with an id of &lt;code&gt;bye&lt;/code&gt;, and when they are clicked run the following callback.” Now, whenever the div is clicked, elements with class &lt;code&gt;west&lt;/code&gt; will slide up and down. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Week 3 Hw notes p2</title>
      <dc:creator>donnellycarroll</dc:creator>
      <pubDate>Tue, 15 Apr 2025 11:51:34 +0000</pubDate>
      <link>https://dev.to/donnellycarroll/week-3-hw-notes-p2-412l</link>
      <guid>https://dev.to/donnellycarroll/week-3-hw-notes-p2-412l</guid>
      <description>&lt;p&gt;Qs:&lt;br&gt;
Don't understand branches - how do you "push" back to main - I think I need this to deploy to render?&lt;/p&gt;

&lt;p&gt;still not passing user tests - but the links work?&lt;/p&gt;

&lt;p&gt;Cloudinary .env variables = are they supposed to be string?&lt;/p&gt;

&lt;p&gt;security holes can be solved with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filters: &lt;code&gt;before_action&lt;/code&gt; and &lt;code&gt;skip_before_action&lt;/code&gt;.
=&amp;gt; Authorization in controller&lt;/li&gt;
&lt;li&gt;Redirecting: &lt;code&gt;redirect_to&lt;/code&gt; and &lt;code&gt;redirect_back&lt;/code&gt;.
=&amp;gt; Authorization in controller&lt;/li&gt;
&lt;li&gt;Devise’s &lt;code&gt;current_user&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;Ruby’s &lt;code&gt;if/else&lt;/code&gt; statements.&lt;/li&gt;
&lt;li&gt;Deleting or limiting routes with &lt;code&gt;only:&lt;/code&gt; and &lt;code&gt;except:&lt;/code&gt; after resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;we ask what routes we actually want and filter them from the &lt;code&gt;routes.rb&lt;/code&gt; with &lt;code&gt;except&lt;/code&gt; or &lt;code&gt;only&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;For the remaining routes, we ask who is allowed to do what on each route.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;git branches:&lt;br&gt;
&lt;code&gt;git checkout -b ec-branch-name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note: in this project, we implemented deterministic rather than random sample data (have a look at the lib/tasks/dev.rake file). This will make the sample data consistent in your app and the target, allowing you to repeatedly test scenarios as you code.&lt;/p&gt;

&lt;p&gt;Step 1: Authorization in controller (only owner can delete own photos)&lt;/p&gt;

&lt;p&gt;Step 2: Conditionals in the view templates&lt;br&gt;
used to hide links that aren’t available to a given user. i.e. if a photo is not owned by someone, then they shouldn’t even see the edit or delete links&lt;/p&gt;

&lt;p&gt;Step 3: Hiding private users: add conditional on user's show page &lt;br&gt;
(If you had an Admin user, usually render two entirely separate view templates (i.e. &lt;code&gt;show&lt;/code&gt;) to avoid excessive control flow in a single view) &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
