Skip to content

Commit

Permalink
Merge pull request doorkeeper-gem#72 from cicloid/master
Browse files Browse the repository at this point in the history
Fix for mass-assignment
  • Loading branch information
piotrj committed Apr 12, 2012
2 parents f5e520e + 9e17acf commit a442099
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/doorkeeper/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Application < ActiveRecord::Base

before_validation :generate_uid, :generate_secret, :on => :create

attr_accessible :name, :redirect_uri

def self.column_names_with_table
self.column_names.map { |c| "oauth_applications.#{c}" }
end
Expand Down
6 changes: 6 additions & 0 deletions spec/models/doorkeeper/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ module Doorkeeper
Factory(:access_token, :resource_owner_id => resource_owner.id, :application => application)
Application.authorized_for(resource_owner).should == [application]
end

it "should fail to mass assign a new application" do
mass_assign = { name: 'Something', redirect_uri: 'http://somewhere.com/something', uid: 123, secret: 'something' }
Application.create(mass_assign).uid.should_not == 123
end

end
end
end

0 comments on commit a442099

Please sign in to comment.