Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dry-view master for default exposures #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gem "dry-struct"
gem "dry-transaction", ">= 0.10.0"
gem "dry-types"
gem "dry-validation"
gem "dry-view", git: 'https://github.com/dry-rb/dry-view', branch: 'add_default_option_to_expose'
gem "dry-view", git: 'https://github.com/dry-rb/dry-view', branch: 'master'
gem "bcrypt"
gem "slim"
gem "shrine"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/dry-rb/dry-view
revision: ed909cd5234a40bc71e5f3eec8bb3d351df93845
branch: add_default_option_to_expose
revision: 7fdb71e0b7ebe62d5deb24cbea7c9a039bd62691
branch: master
specs:
dry-view (0.3.0)
dry-configurable (~> 0.1)
Expand Down
17 changes: 8 additions & 9 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.2
-- Dumped by pg_dump version 9.6.2
-- Dumped from database version 9.5.3
-- Dumped by pg_dump version 9.5.3

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
Expand Down Expand Up @@ -111,37 +110,37 @@ ALTER SEQUENCE tils_id_seq OWNED BY tils.id;


--
-- Name: authors id; Type: DEFAULT; Schema: public; Owner: -
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY authors ALTER COLUMN id SET DEFAULT nextval('authors_id_seq'::regclass);


--
-- Name: tils id; Type: DEFAULT; Schema: public; Owner: -
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY tils ALTER COLUMN id SET DEFAULT nextval('tils_id_seq'::regclass);


--
-- Name: authors authors_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: authors_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY authors
ADD CONSTRAINT authors_pkey PRIMARY KEY (id);


--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (filename);


--
-- Name: tils tils_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: tils_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY tils
Expand Down Expand Up @@ -170,7 +169,7 @@ CREATE INDEX tils_author_id_index ON tils USING btree (author_id);


--
-- Name: tils tils_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
-- Name: tils_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY tils
Expand Down
8 changes: 4 additions & 4 deletions lib/til_web/views/authors/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class Edit < TilWeb::View::Controller
config.template = "authors/edit"
end

private_expose :id

expose :author do |id|
expose :author do |id:|
authors[id]
end

expose :errors, default: []
expose :errors do |errors: []|
errors
end
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/til_web/views/authors/new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class New < TilWeb::View::Controller
config.template = 'authors/new'
end

expose :errors, default: []
expose :errors do |errors: []|
errors
end
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions lib/til_web/views/authors/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class Show < TilWeb::View::Controller
config.template = "authors/show"
end

private_expose :id

expose :author do |id|
expose :author do |id:|
TilWeb::Decorators::Author.new(authors[id])
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/til_web/views/tils/new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class New < TilWeb::View::Controller
config.template = "tils/new"
end

expose :errors, default: []
expose :errors do |errors: []|
errors
end
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions lib/til_web/views/tils/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class Show < TilWeb::View::Controller
config.template = "tils/show"
end

private_expose :id

expose :til do |id|
expose :til do |id:|
tils[id]
end
end
Expand Down