Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 617207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:24:35+00:00 2026-05-13T18:24:35+00:00

I have what seems to me to be a simple declarative_authorization rule, but I’m

  • 0

I have what seems to me to be a simple declarative_authorization rule, but I’m sure it’s just my newness that is causing me to have problems getting it to work.

I have a user and a group. A group has a many-to-one relationship with a user. A particular class (:asset) can have a user & group associated with it. I want to determine authorization to the :asset object if a users is a member of the :asset objects group. Basically, think of the UNIX filesystem security model.

Here is the rule I have written:

has_permission_on [:assets], :to => :manage do
  if_attribute :user => is { user }
  if_attribute :group => is { user.default_group }

  # Idea:
  # if_attribute :group => is_in { user.groups }

end

I’m looking to include my “idea” in the code, but it throws an error. I’m sure it’s something silly I’m doing, I’m just not sure what?

SQLite3::SQLException: ambiguous column name: created_at: 
    SELECT "assets"."id" AS t0_r0, "assets"."friendly_id" AS t0_r1, "assets"."purchased_on" AS t0_r2, "assets"."description" AS t0_r3, "assets"."model" AS t0_r4, "assets"."serial" AS t0_r5, "assets"."user_id" AS t0_r6, "assets"."created_at" AS t0_r7, "assets"."updated_at" AS t0_r8, "assets"."group_id" AS t0_r9, "groups"."id" AS t1_r0, "groups"."name" AS t1_r1, "groups"."created_at" AS t1_r2, "groups"."updated_at" AS t1_r3 
    FROM "assets"  
    LEFT OUTER 
    JOIN "groups" 
    ON "groups".id = "assets".group_id 
    WHERE ((1=1) OR ("assets"."user_id" = 1) OR ("groups"."id" IN (1,2,3)))  
    ORDER BY created_at DESC 
    LIMIT 10 
    OFFSET 0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:24:36+00:00Added an answer on May 13, 2026 at 6:24 pm

    I really haven’t dug that much into declarative_auth but the rules seem to be ok. Based on the log it seems that the order by created_at is ambiguous as there is a ‘created_at’ column in the ‘groups’ table as well.

    Don’t know a straight off the table solution how to fix that but I think it should say order by t0_r7 or order by t1_r2 as those are the aliases given to created_at columns; I don’t know if it matters to you which you use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like a simple problem: I have a WF4 activity that guides the
I'm just trying to do simple scripting with F#, and Math.PI seems to have
I have a simple Poco-Model using abstract classes, and it seems not to work
This seems like it should be so simple, but apparently it isn't. I have
I'm pretty sure that this question already has been answered somewhere. It just seems
It seems I can't easily have an XSD declaration for this simple XML <root>
I have what seems like a simple problem. I have a Spring web app,
Seems like a simple problem: I have an SVN repo inside our firewall. I
I have this simple example I can't seems to get working : MERGE INTO
This seems like such a simple question. I have several Edit boxes on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.