Displaying 3 results from an estimated 3 matches for "new_status".
Did you mean:
net_status
2006 Aug 09
1
question about enforcing constraints in the model
...hrough the user interface. And I don''t want to use
validates_presence_of, since I want the administrator to be able to
not change the status_id of the user and still be able to save other
information.
I have tried the following unsuccessfully:
user.rb
belongs_to :status
def status_id=(new_status_id)
return if new_status_id.blank? or new_status_id == 0
super
end
def status=(new_status)
return if new_status.nil?
super
end
however, calling super in the second instance gives me the following error:
NoMethodError: super: no superclass method `status=''
I''ve also tri...
2007 Jul 07
4
Setting a callback whose action depends on the previous state of the object
I''ve been reading about ActiveRecord::Callbacks and they''re really
cool. But I have a complex need I''m not sure they answer.
Let''s say we have a User model. User has a #status attribute, which
can be either "active", "closed" or "blocked".
I want to set a callback to perform an action if an "active" User has
been
2010 Mar 04
25
how to share variables in data migrations (up/down)
...{
''live'' => ''published on site'',
},
{
''sold'' => ''auction ended'',
},
]
def self.up
statuses.each do |status|
status.each do |name, display_title|
@new_status = Status.new(
:name => name,
:display_title => display_title,
:created_by => ''admin'',
:updated_by => ''admin''
).save
end
end
end
def self.down
statuses.each do |status|...