Hi Paul,
Could you provide us the description of the LEGACY_TABLE (what is
mainly wanted is the type of the column LEGACY_ID ). Also could you
capture the insert statement that is being generated and paste it.
Thanks
Praveen
On Dec 1, 10:23 pm, Paul Harv
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
>
> My app has a model defined like this:
>
> MyModel < ActiveRecord::Base
> set_table_name "SOME_LEGACY_VIEW"
> set_primary_key "LEGACY_ID"
> end
>
> The Database is DB2.
> The view definition looks like this
>
> SELECT
> LEGACY_ID, NAME
> FROM LEGACY_TABLE
>
> When I create a new model and try to save it by doing this...
>
> myModel = MyModel.new
> myModel.name = "TEST"
> myModel.save
>
> Rails is creating an INSERT statement which includes the primary key -
> LEGACY_ID - set to an ampty String. This blows up auto-increment on
> LEGACY_TABLE.
>
> Anyone seen this? Suggested solution.
>
> Note - if LEGACY_ID is removed from the view it works OK, but I''m
> working with requirements that say it should be there.
>
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---