Please make a copy of this repo and complete all 6 challenges below.
This is a standard Rails 7 application, and set up as follows:
- Install Ruby version 3.0.0
- Run
bundle install
- Run
yarn install
- Run
rails db:prepare
Run dev server with bin/dev
See app/poros/task_1.rb
Implement the unique_names
method.
See app/poros/task_2.rb
Implement the group_by_owners
method.
Update this readme.md
file
Select all statements that are correct after the following migration has been executed:
class ContactsMigration < ActiveRecord::Migration
def change
create table :contacts do |t|
t.string :name
t.integer :telephone_number
t.text :address, null: false
t.timestamps
end
end
end
Select all acceptable answers:
- The contacts.name field may be null.
- The contacts table has no index.
- The table called contacts contains four different data types.
- The table called contacts contains four different fields.
- The contacts.address field may be null.
The id column will have an index, and its data type (at least in postgres) will be bigint, making 5 types in all: varchar, integer, text, timestamp, and bigint.
Although this may be different depending on the database engine, I believe this will be the situation for postgres.
Update this readme.md
file
Consider the following controller and view definitions:
class RecordsController < ApplicationController
def update
@record = Record.find(params[:id])
@record.update(record_params)
end
end
<%= form_for record do |f| %>
<%= render "form", f: f %>
<% end %>
Select the routing statements that can be used to update a record. Select all acceptable answers:
- write /records/:id', to: 'records#update'
- put /records/:id', to: 'records#update'
- patch '/records/:id', to: 'records#update'
- post '/records/:id', to: 'records#update'
- resource :records, only: [:update]
See app/poros/task_5.rb
Consider that multiple models make use of the polymorphic :notable and move all the related implementation into a concern.
Extend the application to create Activities
over multiple steps:
Step 1: name [next button]
Step 2: address [back and next buttons]
Step 3: starts_at, ends_at [back and save buttons]
Update the activity model, controller and views to reflect this functionality.
- Every step should have its own form
- Show
"#{current_step} of 3"
- The next step only shows when the current step is valid
- Save on step 3 validates the entire model
- Successful
save
on step 3 redirects toactivities#index
- Should work the same way for
activities#new
andactivities#edit
See app/models/activity.rb
, app/controllers/activities.rb
and app/views/activities/**