blogo 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a5d5e94faa7fd7ef4024abe6af2d124bdf42ea9
4
- data.tar.gz: 6986ac3ac73f001163bbceae1f1e4f1b3103a632
3
+ metadata.gz: 1e8aa0478a935728f8e374637c05bac7d7dbcc36
4
+ data.tar.gz: 5064a990c1ad212586634b8cb161250c7d51a834
5
5
  SHA512:
6
- metadata.gz: 9014979dad91d0d792a39e53aa30bddad628f5df5ee2c39d87784893bb8ba9c48e3d4af7cb2104e96705cc7ce4006c4966a700affacb70ea19109a95a68c7a10
7
- data.tar.gz: 499b77ec8f1d2aaf30d9f8f0bdccc130058066c722a9e94edee8e0beb9bfca4449c47060094e1d5957131d7f9df7a5c3167f19ab006cdfea2483ac14014343fa
6
+ metadata.gz: 31920c856aa217328156539a312bcc8ab8be7370ca0ff17279a3df557a46757448fb53d867799eb57201c69de2534e46b0d0326052d2910960813969bb151296
7
+ data.tar.gz: 3ea88bd62119e88c227c104931875256d01ee134830b59097885b850d05d10fb53cb616330fc11827be22d83a2a034d81ef0d9b36b6f9cb2320007f2a648ea48
@@ -8,7 +8,7 @@ module Blogo::Admin
8
8
  private
9
9
 
10
10
  def ensure_authenticated!
11
- redirect_to admin_login_path unless blogo_current_user
11
+ redirect_to blogo_admin_login_path unless blogo_current_user
12
12
  end
13
13
 
14
14
  def blogo_current_user
@@ -9,7 +9,7 @@ module Blogo::Admin
9
9
  user = Blogo::User.find_by_email(params[:email])
10
10
  if user && user.authenticate(params[:password])
11
11
  session[:blogo_user_id] = user.id
12
- redirect_to admin_url, notice: "You have logged in"
12
+ redirect_to blogo_admin_url, notice: "You have logged in"
13
13
  else
14
14
  flash.now.alert = "Incorrect email or password"
15
15
  render "new"
@@ -18,7 +18,7 @@ module Blogo::Admin
18
18
 
19
19
  def destroy
20
20
  session[:blogo_user_id] = nil
21
- redirect_to admin_url, notice: "You have logged out"
21
+ redirect_to blogo_admin_url, notice: "You have logged out"
22
22
  end
23
23
  end
24
24
  end
@@ -1,8 +1,8 @@
1
1
  class CreateBlogoUsers < ActiveRecord::Migration
2
2
  def change
3
- table_name = "#{Blogo.table_name_prefix}users"
3
+ users_table = "#{Blogo.table_name_prefix}users"
4
4
 
5
- create_table(table_name) do |t|
5
+ create_table(users_table) do |t|
6
6
  t.string :name , null: false
7
7
  t.string :email , null: false
8
8
  t.string :password_digest, null: false
@@ -10,6 +10,6 @@ class CreateBlogoUsers < ActiveRecord::Migration
10
10
  t.timestamps
11
11
  end
12
12
 
13
- add_index table_name, :email, unique: true
13
+ add_index users_table, :email, unique: true
14
14
  end
15
15
  end
@@ -1,13 +1,13 @@
1
1
  class CreateBlogoTags < ActiveRecord::Migration
2
2
  def change
3
- table_name = "#{Blogo.table_name_prefix}tags"
3
+ tags_table = "#{Blogo.table_name_prefix}tags"
4
4
 
5
- create_table(table_name) do |t|
5
+ create_table(tags_table) do |t|
6
6
  t.string :name, null: false
7
7
 
8
8
  t.timestamps
9
9
  end
10
10
 
11
- add_index table_name, :name, unique: true
11
+ add_index tags_table, :name, unique: true
12
12
  end
13
13
  end
@@ -1,8 +1,8 @@
1
1
  class CreateBlogoPosts < ActiveRecord::Migration
2
2
  def change
3
- table_name = "#{Blogo.table_name_prefix}posts"
3
+ posts_table = "#{Blogo.table_name_prefix}posts"
4
4
 
5
- create_table(table_name) do |t|
5
+ create_table(posts_table) do |t|
6
6
  t.integer :user_id , null: false
7
7
  t.string :permalink , null: false
8
8
  t.string :title , null: false
@@ -22,8 +22,13 @@ class CreateBlogoPosts < ActiveRecord::Migration
22
22
  t.timestamps
23
23
  end
24
24
 
25
- add_index table_name, :user_id
26
- add_index table_name, :permalink, unique: true
27
- add_index table_name, :published_at
25
+ add_index posts_table, :user_id
26
+ add_index posts_table, :permalink, unique: true
27
+ add_index posts_table, :published_at
28
+
29
+ if defined?(Foreigner)
30
+ users_table = "#{Blogo.table_name_prefix}users"
31
+ add_foreign_key posts_table, users_table, column: :user_id
32
+ end
28
33
  end
29
34
  end
@@ -1,12 +1,20 @@
1
1
  class CreateBlogoTaggings < ActiveRecord::Migration
2
2
  def change
3
- table_name = "#{Blogo.table_name_prefix}taggings"
3
+ taggings_table = "#{Blogo.table_name_prefix}taggings"
4
4
 
5
- create_table(table_name) do |t|
5
+ create_table(taggings_table) do |t|
6
6
  t.integer :post_id, null: false
7
7
  t.integer :tag_id , null: false
8
8
  end
9
9
 
10
- add_index table_name, [:tag_id, :post_id], unique: true
10
+ add_index taggings_table, [:tag_id, :post_id], unique: true
11
+
12
+ if defined?(Foreigner)
13
+ tags_table = "#{Blogo.table_name_prefix}tags"
14
+ posts_table = "#{Blogo.table_name_prefix}posts"
15
+
16
+ add_foreign_key taggings_table, tags_table , column: :tag_id
17
+ add_foreign_key taggings_table, posts_table, column: :post_id
18
+ end
11
19
  end
12
20
  end
data/lib/blogo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Blogo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Potapov