similar to: Update two models that have belongs_to relationship

Displaying 20 results from an estimated 100 matches similar to: "Update two models that have belongs_to relationship"

2006 Jan 24
0
Showing error messages for two models as one heading
I have two models Program and PointOfContact and here is their relationship Program belongs_to PointOfContact PointOfContact has one Program There is a single form to input a program and it''s associated point of contact information. The default behaviour in Rails seeems to be to show two different error messages (boxes) on the top of the form if there are validation errors in both
2006 Jan 28
8
how to pass search parameters to pagination links
I have a search page with a text_field as below <%= text_field ''program'', ''program_name'' %> After I perform the search in my controller I go to a search results view which shows search results and uses Rails pagination. Now how to pass the search paramters (i.e. params[:program][:program_name] in my controller) to the pagination links (next and
2006 Jan 17
2
change error messages for Validation helpers?
Is it possible to change error messages for Validation helpers? I am writing an app against a existing database (so no control over column names), but when there is validation error (e.g. with validate_presence_of) I would like to customize the field name. For example for telephone whose field name is PhoneNumber I would like to chnage it to "Telephone Number cannot be empty" rather
2006 Jan 05
3
MS SQL server connection problems
I am trying to connect to a remote sql server and I am getting the following error: c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in `connect'': Open (DBI::Databa seError) OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. HRESULT error code:0x80020009 Exception
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following? * For the example with unfortunate disabilities.. look below,,, Usage of has_* (associationmethods) do {def with_deleted AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}... The has_one associations give me a nil object when invoking it with Model.association_OBJECT.with_deleted. Has_many does like
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to, habtm, and the new has_many => :through relationships. Whenever I try a find(:all, :conditions => "some conds", :include [:relationship]) it works fine, but if I have find(:all, :conditions => "some conds", :include [:relationship, :other_relation]) it gets a sql error such as Mysql::Error: You
2006 Jun 01
5
Content Management System
I am looking for a good CMS based on Rails that has at least these attributes: 1. Ease of use ( as it will be used by people who are not html literate) 2. Very easy/flexible to change layout. So far I have looked at http://rcms.oopen.de/Home/ (have not installed it yet) http://adminpages.flowdev.de http://demo.radiantcms.org/admin/pages http://www.eribium.org/eribium/ MuraveyWeb does not seem
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys, I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I could not find anything. I''m using Rspec2. Example: spec/factories/categories.rb ====================== FactoryGirl.define do factory :category_intakes, :class => ''category'' do name ''intakes and filters'' description ''airfilters and
2006 Sep 26
0
Find Returning String Instead of Integer?
Any ideas on why this is? The quantity field in mysql is INT, but I get back a string? This is preventing me from using the increment method. >> @cart = Cart.new => #<Cart:0x2730f40 @new_record=true, @attributes={}> >> @cart.items << Item.find(:first) => [#<Item:0x272d6ec @attributes={"vendor_id"=>"1",
2006 Dec 11
1
Index help on Polymorphic Associations
Hello, I''m a newbie to aaf and rails and I hope anyone can help me with this. I have the following Models: class Project < ActiveRecord::Base acts_as_authorizable acts_as_audited :except => [:created_by, :updated_by ], :user_class_name => ''AuthenticatedSystem'', :user_method => ''current_user'' acts_as_ferret :fields => {:name =>
2006 Jul 04
3
act_as_state_machine plugin inaccessible
Seems like act_as_state_machine plugin is not accessible from http://lunchroom.lunchboxsoftware.com/articles/2006/01/21/acts-as-state-machine as this site is down and script/plugin discover is broken as it fails when trying to add plugin repositories giving the message as below; Add http://svn.northpub.com/plugins/? [Y/n] y (eval):3:in `each'': undefined method `[]'' for
2006 Jan 20
11
Userstamp Plugin
I''m pleased to announce a new plugin for Rails: Userstamp. You can read my blog post at http://www.delynnberry.com/articles/2006/01/20/userstamp-plugin and/or read all about it at the perminant page http://www.delynnberry.com/pages/userstamp. Any comments or suggestions for improvement are much appreciated. -- DeLynn Berry delynn@gmail.com http://www.delynnberry.com A dump of the Readme
2006 Apr 23
1
file_column does not work with update model
When I am creating a model, everything works but not during update (where I use Model.update_attributes(model_attributes) ). I get the error: Do not know how to handle a string with value ''image_xxx.jpg'' that was passed to a file_column. Check if the form''s encoding has been set to ''multipart/form-data''. The form is indeed multipart. Does
2006 Feb 01
1
Rails pagination problem
I am having this problem with pagination query in my controller class. I am using SQL server and following code to create pagination fails, complains about column name ''program_name'' (which is valid column/attribute of program) The error message is: DBI::DatabaseError: S0022 (207) [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name
2007 Apr 07
2
functional test question
I have a view that passes two params hashes (:user and :school) to my controller action. In the functional test for the controller action, how do pass these two hashes? I tried the following that did not work get(:create, [:user => {:firstname => ''xxx'', :lastname => ''yyyy''}, :school => {:id => 1}] ) It seems to pick only the first array
2006 Aug 12
0
insert into database failing
hi all, i am trying a little project based on the agile book''s shopping cart example and have hit a problem. the inserts are failing when saving a quote which contains line_items. the models are as follows (quote_line_item is using single table inheritance): class Quote < ActiveRecord::Base has_many :quote_line_items end class LineItem < ActiveRecord::Base end class
2006 Apr 12
0
class attributes and thread safety
Are class attributes thread safe? For instance, the userstamp plugin creates a User.current_user attribute and then it aliases the ActiveRecard create and update methods to write created_by and updated_by attributes using the value of User.current_user. For some reason I can imagine a case where multiple users are logged in at the same time and saving objects, and the value of
2006 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out why I keep getting the ''wrong number of arguments (1 for 2)'' error with the following code when I try to create a new record. If anyone can see what is going wrong here please help! new.rhtml ------------------------------------------------- ... <%= start_form_tag :action =>
2006 Apr 19
0
How to rubify this query
Hi guys, i spent about 5 hours now of finding out how to rubify/railify this query! Maybe someone of you can help me ;) class Menu < ActiveRecord::Base validates_uniqueness_of :handle validates_presence_of :name, :sequence, :accesslevel, :defaultpage, :handle belongs_to :cmodule belongs_to :creator, :class_name => ''User'', :foreign_key =>
2007 Jul 30
0
Rails/MSSQL error
Hi, I have been encountering this error when I try to save text with japanese characters: DBI::DatabaseError: Execute OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server Line 1: Incorrect syntax near ''20070730''. HRESULT error code:0x80020009 Exception occurred.: INSERT INTO categories ([category_name], [updated_at], [created_by],