Skip to content

Instantly share code, notes, and snippets.

Usuario.where('login in (?)', ['a', 'b', 'c']).update_all( status: :bloqueado )
Usuario.where('login in (?)', ['a', 'b', 'c']).each do|u|
u.update_attribute :status, :bloqueado
end
class Picapau
def voa
p 'estou voando'
end
end
woody = Picapau.new
amigo = Picapau.new
woody.voa # => estou voando
@AnyMetaDef(idType = "long", metaType = "long", metaValues = {
@MetaValue(value = "1", targetEntity = Restaurante.class),
@MetaValue(value = "2", targetEntity = Prato.class) })
@AnyMetaDef(idType = "long", metaType = "string", metaValues = {
@MetaValue(value = "RESTAURANTE", targetEntity = Restaurante.class),
@MetaValue(value = "PRATO", targetEntity = Prato.class) })
@Entity
public class Comentario {
@Id
@GeneratedValue
private long id;
private String comentario;
@Any(metaColumn = @Column(name = "detail_type"))
@AnyMetaDef(idType = "long", metaType = "string", metaValues = {
@Entity
@SequenceGenerator(name = "Entidade_Seq")
public class Entidade {
@Id
@GeneratedValue(generator = "Entidade_Seq", strategy = GenerationType.AUTO)
private int id;
}
@Entity
public class Entidade{
@Id
@GeneratedValue
private int id;
}
private test() {
System.out.println("two");
}
private test() {
{
System.out.println("two");
}
}