Skip to content

Commit

Permalink
Remove attr_accessible calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
stas committed Apr 19, 2013
1 parent c71afe0 commit d6b4ead
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions lib/doorkeeper/models/access_grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class AccessGrant

belongs_to :application, :class_name => "Doorkeeper::Application", :inverse_of => :access_grants

attr_accessible :resource_owner_id, :application_id, :expires_in, :redirect_uri, :scopes

validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, :presence => true
validates :token, :uniqueness => true

Expand Down
1 change: 0 additions & 1 deletion lib/doorkeeper/models/access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AccessToken
validates :refresh_token, :uniqueness => true, :if => :use_refresh_token?

attr_accessor :use_refresh_token
attr_accessible :application_id, :resource_owner_id, :expires_in, :scopes, :use_refresh_token

before_validation :generate_token, :on => :create
before_validation :generate_refresh_token, :on => :create, :if => :use_refresh_token?
Expand Down
2 changes: 0 additions & 2 deletions lib/doorkeeper/models/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class Application

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

attr_accessible :name, :redirect_uri

def self.model_name
ActiveModel::Name.new(self, Doorkeeper, 'Application')
end
Expand Down
2 changes: 0 additions & 2 deletions spec/dummy/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class User
end

class User
attr_accessible :name, :password

def self.authenticate!(name, password)
User.where(:name => name, :password => password).first
end
Expand Down

5 comments on commit d6b4ead

@tsov
Copy link

@tsov tsov commented on d6b4ead Jun 27, 2013

Choose a reason for hiding this comment

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

I keep getting ActiveModel::MassAssignmentSecurity::Error. I wonder if this is the cause? Can I ask why this was removed?

@stas
Copy link
Contributor Author

@stas stas commented on d6b4ead Jun 27, 2013

Choose a reason for hiding this comment

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

The reason is that attr_accessible is not available anymore in rails 4 (see this)

Are you sure you are getting this error from using Doorkeeper, if so, could you share a gist with relevant code?

@tsov
Copy link

@tsov tsov commented on d6b4ead Jun 27, 2013

Choose a reason for hiding this comment

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

Right! Sorry, completely forgot!
Well the error is very unexpected. I added a quick solution for an assertion flow (#249). With my additions ActiveModel::MassAssignmentSecurity::Error is raised for every model creation, but when I use the applicake/doorkeeper at master no exceptions are raised at all, even though I didn't modify the models in my pull request.
Can you see anything I might have changed in my PR? All the tests pass.

@stas
Copy link
Contributor Author

@stas stas commented on d6b4ead Jun 27, 2013

Choose a reason for hiding this comment

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

I just cloned your repo and tests pass.

@tsov
Copy link

@tsov tsov commented on d6b4ead Jun 27, 2013

Choose a reason for hiding this comment

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

Yeah, i added a few tests to check if the assertion flow works, but once i include my version tsov/doorkeeper at master to my rails project (version 3.2.13), the exceptions are raised. It seems like such an unexpected error. Is it supposed to raise the mass assignment security error in rails 3?

Please sign in to comment.