-
Notifications
You must be signed in to change notification settings - Fork 230
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
Rails 4 support #194
Rails 4 support #194
Conversation
Yeah I did not pull request my changes, was just a personal fork. They were intended only for an internal project. Not sure if there is a GitHub protocol to indicate that beyond not pull requesting. Thanks for this work! |
What's the status on this? Need these changes to get a migration to 4.1 to pass. I'm hopping on your branch @zeiv for now!! |
ping @stffn. |
Thanks @zeiv for providing the bridge code we need |
I've tried out this patch, but I'm getting an error that wasn't present before.
Using: if_attribute members: { receiver: is { user } } Abridged trace:
Could be because receiver is polymorphic? |
Hi @maletor, would you be able to post the relevant associations? I'm guessing part of it is something like: class Message < ActiveRecord::Base
belongs_to :members
has_many :conversations
end
class Member < ActiveRecord::Base
has_many :messages
has_many :conversations, :through => :messages
end
class Conversation < ActiveRecord::Base
has_many :messages
has_many :members, :through => :messages
end But you mentioned it was polymorphic, and a |
Hoping to get around to this at some point. Probably will be next week. On Sunday, July 20, 2014, Xavier Bick [email protected] wrote:
|
Thanks zeiv, I really appreciate You effort on this ! |
Hmm okay. It looks like I may have broken something with my "fix" to #193... I doubt I'll be able to look at it today, though. Hopefully over the weekend. Thanks for the feedback, everyone! |
Experiencing the following error:
Any ideas? |
Main Changes:
unloadable
methodscoped
method in favor ofall
,where(nil)
, and finder methods such asjoins
references
methodTodo / Issues
All tests passing on:
For strong_parameters, I added a
:strong_parameters
option tofilter_resource_access
that accepts a boolean. It defaults to try on rails > 4 and false on rails < 4. When:strong_parameters
is enabled, declarative_authorization will not create a new object or set an instance variable for thecreate
action because strong_parameters's use of a private method to sanitize parameters expects that the object will be created in the original controller. This patch will, however, create an empty object for the instance variable ofnew
actions.You can see in the commit history that I initially used @gordonbisnor's fix which involved simply permitting all parameters for all
filter_resource_access
controllers. It was clean and it worked, but I ended up deciding that this was a too large a vulnerability and removed the fix. The best way to handle strong_parameters and in RESTful controllers with declarative_authorization is to simply use the Rails default method, which looks something like this:❗IMPORTANT NOTE❗
After switching rubies with RVM, Rails 4.1 returns 3 failures:
HelperTest#test_has_role_with_guest_user
,AuthorizationTest#test_default_role
, andAuthorizationTest#test_guest_user
. Raking a second time (no changes) returns only one failure:HelperTest#test_has_role_with_guest_user
. After that, all tests pass, then it alternates between that one failure and all passing. Does anyone know what might be causing this? I'm marking Rails 4.1.4 as passing since my best guess is that it's a problem with the test suite.I also recommend a version bump, possibly to 0.6.0?