Displaying 20 results from an estimated 1000 matches similar to: "Nubee Callbacks problem"
2006 Jul 18
2
how to generate calculated db fields
I''m trying to generate a "page slug" i.e. a url sanitized id from  
some text in my model that I want to be saved into the database and  
I''m not seeing how I can do it.
The closest I''ve come to getting this to work has been...
class Page < ActiveRecord::Base
   attr :name
   before_save :generate_slug
   def generate_slug
     self.slug = self.name.gsub
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a
separate process, so it is important that when a record is saved in
rails, this column should be left alone. In the update method of the
controller I have:
@record = MyModel.find(params[:id])
@record.update_attributes(params[:my_model])
params[:my_model] doesn''t have a reference to the column I''m talking
2006 Jun 07
2
Problem with a setter that converts euros to cents
Hi,
I have some problems with an application where I''m using custom
accessors to do currency conversions. In my model, I have a price
attribute in the database that stores the value in cents, to avoid
future problems with float arithmetic and round. But at the views, I
would like to show the price in euros, with decimal for the cents. So
I defined a new attribute called price_in_euros,
2007 Jan 26
7
How to protect attributes from being updated?
Hi!
I''m new to Rails!
Rails rox!
1 quesion so far:
I have :email attribute in User model.
I dont'' want :email to allow to be updated.
How do i do this with Rails?
Do I have to implement required validation manually?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object
was newly created?
Hopefully this will explain my question:
A Firm class declares
has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients
and a
client class declares
2005 Apr 23
7
Validation question
Hi all,
	Is there a way to invoke validations at times other than save, create 
and update? I know that I can do this by writing my own validation 
checks using errors.add_[blah], but I''d like to leverage the existing 
validation code.
	What I have is two sets of fields in a record, set A and set B. Both 
sets must be validated on record create. However, the trouble is that 
after
2006 Jan 20
47
SQL Server datetime error
i have a problem with the datetime format of rails. i am unable to save 
a dataset to the db. here''s the error message -- the original error 
message was in german, so i translated it -- i get:
DBI::DatabaseError: Execute
    OLE error code:80040E07 in Microsoft OLE DB Provider for SQL Server
      Couldn''t convert a char-Datatype to datetime
    HRESULT error code:0x80020009
  
2006 Jun 13
9
act_as_versioned and join tables?
Greetings!
I''m attempting to use the act_as_versioned plugin to provide versioning 
functionality for my rails app, but can''t think my way through this:
How can you use act_as_versioned to perform versioning on a HABTM join 
table?  It is easy to see how to do so for join models (:has_many 
:through) but not so for the join table.
I want to use act_as_versioned to maintain
2006 Mar 15
1
Through method problems with custom foreign_keys
A person has a many company_branches and
A company_branch has many people.
This join is represented using a "contacts" table.
I am using a legacy schema so i am forced into using non-standard rails 
primary keys. I am using the new through relationship in rails 1.1.
p=Person.find(1)
b=p.company_branches # gives this error:
ActiveRecord::StatementInvalid: OCIError: ORA-00904: 
2007 Oct 29
2
error message after upgrading to Gusty Gibbon Ubuntu
I have started to get the error message "wrong number of arguments (1
for 0)" since I upgraded to Gusty Gibbon.
I am new to ROR so I have no clue.
This is the code that was running
  def create
    @user = User.new(params[:user])
    if @user.save
      flash[:notice] = ''User was successfully created.''
      redirect_to :action => ''list''
    else
2008 Jun 20
15
before_save model callback rspec testing
hi all,
i''m learning rspec and i can''t figure out how to test if a callback is
executed in a model.
my model code is:
class User < ActiveRecord::Base
  before_save :encrypt_password
...
 def encrypt(password)
    self.class.encrypt(password, salt)
 end
thanks a lot,
cs.
-- 
Posted via http://www.ruby-forum.com/.
2006 Mar 27
2
Form Validation with 2 models on form. Nubee Question
I have one form in which i enter Person data and Employee Data. A Person 
and Employee model are used.  I am using a legacy schema, so this is 
forced.
How do i use save the data while using rails form validation??  I only 
want both models to save if they both save.
Controller :
This odviously doesnt work:
def create_employee_and_person
  employee = Employee.new(params[:employee])
  person =
2006 May 03
1
Nubee Fixtures + Tests problem
According to the book, @timesheets["first_timesheet"] should be 
accesible from within my functional test, but its not!
Timesheets.yml :
first_timesheet:
  status: 2
  start_date: 2006-04-24
  cost: 10
  employee: 444
  id: 10683
  charge: 20
My Test :
class AdminTimesheetsControllerTest < Test::Unit::TestCase
  fixtures :timesheets
  def test_viewTimesheet
    get
2006 May 09
3
"ActiveRecord::Base.connection.execute" nubee problem
Is there any way of executing a full sql script, and not just one 
statement?
You can do this:
ActiveRecord::Base.connection.execute("insert into batches (name) values 
''name''")
but not this:
ActiveRecord::Base.connection.execute("insert into batches (name) values 
''name''; "insert into batches (name) values
2006 Apr 04
4
Cannot upgrade rails to 1.1, only 1.0. Nubee. Please help
I''ve used putty to SSH in to our solaris system as root:
Here is what happens when i try to install rails:
# gem install rails -include-dependencies -p http://saiproxy:3128
Attempting local installation of ''rails''
Local gem file not found: rails*.gem
Attempting remote installation of ''rails''
Successfully installed rails-1.0.0
So my question is why
2008 Mar 14
15
Is anyone running Rails 2.x against a MS SQL Server DB?
I am unable to get ActiveRecord session support to work under 2.x
against a SQL Server database.  I''m starting to wonder if anyone is
running 2.x against SQL Server?
Is anyone running under the following configuration:
Rails 2.x
SQL Server 2000 DB (using AR adapter in ODBC mode)
AR store for ActionController session store.
I''d like to chat with you if you are.
Thanks,
Wes
-- 
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of
our rails apps and created a test project to try out different theories
on what was going on.  The result so far is a very small test case app
that perfectly reproduces the problem.  The question is, is there
anything *wrong* with what we''re doing here, or is it a problem with
ActiveRecord?  We''re on rails
2006 Apr 27
6
Functional Test Problem. Nubee, please help
ALl my controllers require the user to be logged in.  SO they will be 
redirected to my "login" controller.
How do i login first in a functional test?  Im assuming i use the setup 
method to login the controller.
This is the setup method for the Activities controller functional test:
  def setup
    @controller = ActivitiesController.new
    @request    =
2006 Aug 09
1
question about enforcing constraints in the model
I have a user model and a status model.  Each user has a specific
status (accepted, rejected, declined, etc).
I have a form that allows the adminstrator to change certain options
for a user, including their status.  I''m using a drop down menu
populated with the different status values, and a default option that
says "Choose a new status" with a value of "".
I want to
2008 Mar 11
6
saving an ActiveRecord without trigging the callbacks
Hello,
How can I save an ActiveRecord without trigger before_save,
after_save, etc?
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group,