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

68-rola-autora #361

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,3 @@ DEPENDENCIES
twitter-bootstrap-rails
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.11.2
3 changes: 2 additions & 1 deletion app/models/authorship.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Authorship < ActiveRecord::Base
validates :person, presence: true, uniqueness: { scope: :submission_id }

validates :author_role, presence: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wystarczyłoby role


belongs_to :person
accepts_nested_attributes_for :person

Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20160226111840_add_author_role_to_authorship.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddAuthorRoleToAuthorship < ActiveRecord::Migration
def change
add_reference :authorships, :author_role, index: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to powinno być pole tekstowe:

add_column :authorships, :role, :string

end
end

17 changes: 10 additions & 7 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20160223153523) do
ActiveRecord::Schema.define(version: 20160226111840) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -63,13 +63,15 @@
create_table "authorships", force: :cascade do |t|
t.integer "person_id"
t.integer "submission_id"
t.boolean "corresponding", default: true
t.integer "position", default: 0
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "signed", default: false
t.boolean "corresponding", default: true
t.integer "position", default: 0
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "signed", default: false
t.integer "author_role_id"
end

add_index "authorships", ["author_role_id"], name: "index_authorships_on_author_role_id", using: :btree
add_index "authorships", ["person_id", "submission_id"], name: "index_authorships_on_person_id_and_submission_id", unique: true, using: :btree
add_index "authorships", ["person_id"], name: "index_authorships_on_person_id", using: :btree
add_index "authorships", ["submission_id"], name: "index_authorships_on_submission_id", using: :btree
Expand Down Expand Up @@ -133,8 +135,8 @@
t.string "sex"
t.string "photo"
t.text "competence"
t.text "discipline", default: [], null: false, array: true
t.string "reviewer_status"
t.text "discipline", default: [], null: false, array: true
end

add_index "people", ["email"], name: "index_people_on_email", using: :btree
Expand Down Expand Up @@ -341,6 +343,7 @@
t.datetime "updated_at", null: false
t.integer "person_id"
t.integer "issue_id"
t.string "author_role"
t.integer "follow_up_id"
end

Expand Down