如何在haml中的复选框内写条件?

时间:2018-03-06 15:17:14

标签: html ruby-on-rails haml

我是haml的新手,我已经学习了haml的基础知识,我现在能够用haml转换一个简单的html表单,但我遇到了一个小问题。我正在使用haml转换此代码但无法执行此操作。我从最近3个小时开始尝试。我也谷歌它但没有找到任何可用的答案 Haml: If statement inside attribute declaration

我正在转换此代码

<input class="prime campaign_chkbox" data-type="payrolloption" id="<%= element['id'] %>" type="checkbox" <%if element['payrolloption']==1 %> checked <%end%> >

1 个答案:

答案 0 :(得分:1)

我解决了它

DECLARE @Obj_sql VARCHAR(2000)
DECLARE @Obj_table TABLE (DBName VARCHAR(200), UserName VARCHAR(250), ObjectName VARCHAR(500), Permission VARCHAR(200), objecttype varchar(200))
SET @Obj_sql='select ''?'' as DBName,U.name as username, O.name as object,  permission_name as permission, o.type from ?.sys.database_permissions
join ?.sys.sysusers U on grantee_principal_id = uid join ?.sys.sysobjects O on major_id = id WHERE ''?'' NOT IN (''master'',''msdb'',''model'',''tempdb'') order by U.name '

INSERT @Obj_table
EXEC sp_msforeachdb @command1=@Obj_sql

SELECT * FROM @Obj_table
where UserName = 'RSExecRole' --edit with username you're looking for
and objecttype = 'P'