Displaying 2 results from an estimated 2 matches for "usuario_id".
2010 Aug 03
10
Returning last value
Hi.
I have the following controller of the update action:
[code]
def update
@projeto = Projeto.find(params[:id])
if (@projeto.update_attributes(params[:projeto]))
## Mesmo raciocínio utilizado no create.
@permissaoA = Permissao.find(:first, :conditions => ["usuario_id =
?", @projeto.responsavel.to_i])
@permissaoAvancado1 = Permissao.find(:first, :conditions =>
["projeto_id = ? and usuario_id = ?", 0, @projeto.responsavel.to_i])
if @permissaoAvancado1.nil?
## Caso tenham excluido os usuários responsáveis, as permissões
seriam nulas....
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql
"SELECT * from convenios where id NOT IN
(SELECT convenio_id from solicituds where usuario_id=?"
but don''t find a way of used it in rails
except
find_by_sql.
There is a another way??
class Usuario < ActiveRecord::Base
belongs_to :persona
has_many :solicituds, :dependent => :destroy
has_many :convenios, :through => :solicituds
has_many :nivelesacceso
has_...