Hi Stan,

Try something like this

def initialize(user, proposal_request_id)
  can :create, Proposal unless Proposal.exists?(:proposal_request_id => 
proposal_request_id, :user_id => user.id)
end



On Wednesday, November 14, 2012 1:07:51 AM UTC+2, Stan McFarland wrote:
>
> Hi,  RoR newbie here.  Fairly new, anyway. :). I have a cancan question 
> I'm hoping someone can help me with.  I have two models - ProposalRequest 
> and Proposal.    Each ProposalRequest can have many Proposals, but a given 
> user can submit only one Proposal for each ProposalRequest.  I can't figure 
> out how to define the rule in ability.rb for the create action.   Can 
> someone help?
>
> Thanks
>
> Stan McFarland
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/C2JHMCCGGccJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to