wheels 0.0.36 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.36
1
+ 0.0.37
@@ -20,5 +20,16 @@ class BlogsController < InheritedResources::Base
20
20
  @blogs ||= Blog.where(:user_id=>@user.id).
21
21
  paginate(:page => params[:page], :order => 'created_at DESC' )
22
22
  end
23
+
24
+ before_filter :authenticate_user!, :except=>[:show]
25
+ before_filter :maybe_authenticate, :only=>[:show]
26
+ before_filter :resource, :only=>[:update, :show, :destroy, :edit]
27
+ authorize_resource
28
+
29
+ def maybe_authenticate
30
+ unless user_signed_in?
31
+ authenticate_user! unless current_ability.can? :read, resource
32
+ end
33
+ end
23
34
  end
24
35
 
data/app/models/image.rb CHANGED
@@ -4,7 +4,7 @@ class Image < ActiveRecord::Base
4
4
  has_attached_file :image,
5
5
  :storage => :s3,
6
6
  :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
7
- :path => "/images/:style/:filename",
8
- :styles => { :medium => "300x300>", :thumb => "100x100>" }
7
+ :path => "/images/:user_email/:style/:filename",
8
+ :styles => {:medium => "300x300>", :thumb => "100x100>" }
9
9
  end
10
10
 
@@ -0,0 +1,4 @@
1
+ Paperclip.interpolates :user_email do |attachment, style|
2
+ attachment.instance.gallery.user.email
3
+ end
4
+
data/lib/wheels.rb CHANGED
@@ -3,5 +3,6 @@ require 'wheels/routes.rb'
3
3
  require 'wheels/action_controller_extensions.rb'
4
4
  require 'wheels/action_view_helper_extensions.rb'
5
5
  require 'wheels/flash_session_cookie_middleware.rb'
6
+ require 'wheels/paperclip_interpolations.rb'
6
7
  # require 'wheels/s3login_provider.rb'
7
8
 
data/wheels.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.0.36"
8
+ s.version = "0.0.37"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
@@ -213,6 +213,7 @@ Gem::Specification.new do |s|
213
213
  "lib/wheels/active_record_extensions.rb",
214
214
  "lib/wheels/active_record_user_extensions.rb",
215
215
  "lib/wheels/flash_session_cookie_middleware.rb",
216
+ "lib/wheels/paperclip_interpolations.rb",
216
217
  "lib/wheels/routes.rb",
217
218
  "lib/wheels/s3login_provider.rb",
218
219
  "lib/wheels/user.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wheels
3
3
  version: !ruby/object:Gem::Version
4
- hash: 87
4
+ hash: 85
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 36
10
- version: 0.0.36
9
+ - 37
10
+ version: 0.0.37
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -238,6 +238,7 @@ files:
238
238
  - lib/wheels/active_record_extensions.rb
239
239
  - lib/wheels/active_record_user_extensions.rb
240
240
  - lib/wheels/flash_session_cookie_middleware.rb
241
+ - lib/wheels/paperclip_interpolations.rb
241
242
  - lib/wheels/routes.rb
242
243
  - lib/wheels/s3login_provider.rb
243
244
  - lib/wheels/user.rb