similar to: ActiveRecord: Minor saving problem

Displaying 20 results from an estimated 400 matches similar to: "ActiveRecord: Minor saving problem"

2006 Apr 03
7
Getters and setters problem?
Hi list, first evening of playing with rails, so please forgive me if I ask something stupid. ;-) I created a User model and tried to use ActiveRecord callbacks to convert the password to sha1 just before saving it. For some reason postgresql gives me a error because the given password is null. To test even further I tried to change :login too, same error happens, :login is empty too. I am sure
2007 Jan 24
2
A spec where interaction-based testing breaks down... (at least for now)
Here are the specs: context "Finding all the stylesheets available to a company" do setup do @mock_company = mock("company") @mock_company.stub!(:to_param).and_return "1" Stylesheet.stub!(:find) end def do_find Stylesheet.find_available_to @mock_company end specify "should convert the company into a parameter" do
2006 Jan 03
4
Would someone like to tell me why this code will not solve my problem? (it''s short)
I am building an invoicing system but cannot use the auto_increment field to determine the invoice number (because they are running 3 different companies off the one system. I need to find the last invoice number from any given company and then add 1 to it to get the next invoice number. BUT, there is a unique case on the very first invoice produced because there is no earlier invoice
2005 Sep 02
7
Form to update two tables
Hello there, this is probably a very simple problem but I''m stuck. I''m following the Login generator tutorial from rubyonrails. It''s all worked fine so far. But I want to add a bit more functionality so that when a user signs up in addition to chosing a login name and password they type in a company name which is added to a seperate table called COMPANIES. The id
2009 Mar 17
1
Route failure with Rails2.3 and rspec1.2
Hello all, I have a spec for a route that used to pass under Rails 2.2.2 and rspec 1.1.12, but can?t figure out what is wrong since I updated. Here is the assertion: route_for( { :controller => ''purchase_orders'', :action => ''update'', :company_id => "32", :id
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
2005 Oct 26
1
Re: collection_select question about selected_value
Paul Welty wrote: > collection_select(:client, :company_id, @companies, :id, :name, { > :selected_value => 2 , :prompt => "Please select a company..." }) > > Returns a functioning SELECT element, but it won¹t select the second item. > (BTW, using the selected_value as a string doesn¹t work either) > > Am I doing something wrong, or is this impossible? >
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there, Im happilly coding my first rails app, and all goes well. I find myself manually coding in a particular field all the time (company_id), that relates the contact to a company. The total coding of this form seems somewhat much. Could somebody tell me what Rails power I''m possibly missing and stuborn as I am trying to do myself? I was wondering if the
2005 Aug 19
2
data validation
I''m trying validate date before they''re stored into the DB, but it seems, validation doesn''t work.. my model looks like this: class Company < ActiveRecord::Base has_many :contacts, :foreign_key =>''company_id'' has_and_belongs_to_many :categories, :join_table => ''company_to_category'', :foreign_key =>
2006 Aug 14
1
Rest, routes, path_prefix and default params
I am trying to use routes with default params to have routes ''/mycompany/departments'' and ''/companies/1/departments'' mean the same thing (both restful routes). When I set up the files as below, I get an error of ''Couldn''t find Company without an ID'' and my log file shows the following .. Processing DepartmentsController#index (for
2005 Dec 22
3
foreign_key setting ignored
I''m having a spot of bother creating a ''has_many'' relationship between two legacy database tables. The relationship is ''company'' table has many linked records in the ''contact'' table. Iv''e used ''generate scaffold'' on these tables and everything is fine. I then decided to define the relationship in the
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
Hello, I''m working with scaffold generated controller test code for handling GET requests. Address is the model being tested. Address belongs_to Company, Company has_many addresses. In my addresses_controller I have: before_filter :get_company def index @addresses = @company.addresses.find(:all) respond_to do |format| format.html # index.html.erb format.xml {
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the model name, and optionally some conditions, and it generates a paginated query for you. This gets to be very bad if you''ve got any custom queries. class Company < ActiveRecord::Base def complete_videos Video.find :all, :conditions => "company_id=#{id} AND status=''complete''", :order
2008 Jan 03
1
Memory leak and long process problem
I use backgroundrb for many long tasks in my system, but I''m having issues with one in particular. Two large tasks for me are importing people and updating companies. def import_contacts(args = nil) thread_pool.defer(args) do |job_id| begin job = ImportJob.find(job_id) job.process_job rescue => err logger.error "MscWorker#import_contacts
2006 Apr 26
2
two layers of has_many
Hi, There are many companies. Each company has many departments. Each department has many employees. The following find_by_sql method seems awful. What is the best way to get all the employees of a company? class Company < ActiveRecord::Base has_many :departments def employees Employee.find_by_sql("SELECT employees.* FROM companies, departments, employees
2005 Dec 15
2
efficient INSERTS
Hi, I''ve got the following models: Company Package with a habtm relationship. In my controller, I have a ''dispatch'' action which does the following @companies.each do |company| @packages.each do |package| company.packages.push_with_attributes(package, :sent_on => Time.now) end end my table ''companies_packages'' therefore lists which
1997 Sep 26
1
Samba 1.9.17 fails to truncate share mode file (fwd)
Thank you for the information that you have passed on to me. My own research has found that ftruncate is quite happy to set a file to the same size that it is already, so something else must be causing the problem. The comment before the ftruncate in set_share_mode says the file is being truncated just for safety, so normally it is probably not necessary to truncate the file. Regards, Tim >
2007 Oct 25
0
6 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_movie.c test/trace
libswfdec/swfdec_as_interpret.c | 2 libswfdec/swfdec_movie.c | 2 test/trace/Makefile.am | 18 +++++++ test/trace/initaction-queue-5.swf |binary test/trace/initaction-queue-5.swf.trace | 1 test/trace/initaction-queue-6.swf |binary test/trace/initaction-queue-6.swf.trace | 2
2010 Aug 20
2
The M in ORM
Hi everyone, I am attempting to connect an already existing mysql database with Rails. For This I can''t use the traditional "generate scaffold" and "rake db:migrate" because (I think), I''ll loose the data already existing in that database table. So what I did was, I generated a scaffold for my table, and instead of running db:migrate, I added a
1997 Oct 01
0
FW: Samba 1.9.17 fails to truncate share mode file (fwd)
Although the bug in Samba 1.9.17p1 which caused "ERROR: set_share_mode: failed to ftruncate share mode file" messages in log.smb has been fixed in 1.9.17p2, empty share* files are not being deleted from the lock file directory. Regards, Tim > Tim Boorman > UNIX Systems Support > Lusis Limited, Technology Drive, Bridgend Science Park, Bridgend, > United Kingdom CF31 3UJ