This project is archived and is in readonly mode.

#6580 ✓resolved
Javix

attribute_methods.rb:273: syntax error, unexpected tGVAR, expecting $end

Reported by Javix | March 15th, 2011 @ 09:14 AM | in 3.0.6

When trying to set a value on Oracle DB by using 'send' I got the below error:

Reading supplier name before update: DP China / Shanghai -   SHENZHOU KNITTING(AN HUI)CO.LTD
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:271:in `module_eval': C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:272: syntax error, unexpected tGVAR, expecting ')' (SyntaxError)
                  if method_defined?(:blob$entrysetadhocacl?)
                                                           ^
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:273: syntax error, unexpected tGVAR, expecting $end
                    undef :blob$entrysetadhocacl?
                                                ^
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:271:in `block (2 levels) in define_attribute_methods'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:262:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:262:in `block in define_attribute_methods'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:261:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:261:in `define_attribute_methods'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:13:in `define_attribute_methods'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:41:in `method_missing'
        from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:44:in `update_dpp_suplliers'
        from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:37:in `initialize'
        from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:51:in `new'
        from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:51:in `<main>'

Here is how I tried to update a record in a Oracle DB in a separate Ruby file:

require 'rubygems'
require 'active_record'


ActiveRecord::Base.establish_connection(
  :adapter => 'oracle_enhanced',
  :database => 'db_name',  
  :username => 'user',
  :password => 'pwd'
)

class Supplier < ActiveRecord::Base
  set_table_name :lcssupplier    
end

class RunUpdate  
  def initialize(env = "dev")    
    @env = env
    case @env
    when 'dev'      
      @name = 'att1'
    else
      raise "Unknown environment: #{env}"
    end    
    update_dpp_suplliers
  end

  private
  def update_dpp_suplliers
    dpp_supplier = Supplier.where(:num2=>56180).first
    puts "Reading supplier name before update: #{dpp_supplier.read_attribute(@name)}"
    dpp_supplier.send("#{@name}=", "TOTO")
    dpp_supplier.save!
    puts "DPP supplier name AFTER update: #{dpp_supplier.read_attribute(@name)}"
   
  end  
end

RunUpdate.new('dev')

The same code works without any problem on another MySQL Db. the only difference is that in MySQL the table was created according to RoR convention and I didn't have to put 'set_table_name :lcssupplier' declaration in the AR Supplier class.
Any idea on what I did wrong here? Thanks

Comments and changes to this ticket

  • Javix

    Javix March 15th, 2011 @ 03:55 PM

    Here is the code (almost the sameà that work fine on MySQL:

    require 'rubygems'
    require 'active_record'
    
    ActiveRecord::Base.establish_connection(
      :adapter => 'mysql2',
      :database => 'myapp_development',
      :host => 'localhost',
      :username => 'root',
      :password => ''
    )
    
    class User < ActiveRecord::Base            
    end
    
    class RunUpdate  
      def initialize
        @att1 = 'firstname'
        update_user
      end
    
      private
      def update_user
        user = User.first
        puts "att1: #{@att1}"
        puts "reading att1: #{user.read_attribute(@att1)}"
        user.update_attribute(@att1, "George")
        puts "Modified: #{user.inspect}"
      end
    end
    
    
    RunUpdate.new
    
  • Javix

    Javix March 15th, 2011 @ 04:26 PM

    Even trying to read an attribute value after defining it explicitly, gives the error:

    require 'rubygems'
    require 'active_record'
    
    ActiveRecord::Base.establish_connection(
      :adapter => 'oracle_enhanced',
      :database => 'my_database',  
      :username => 'user',
      :password => 'pwd'
    )
    class Supplier < ActiveRecord::Base
      set_table_name :lcssupplier
      set_primary_key :ida2a2
      attr_accessor :att1 #nevertheless we don't have to define it, in MySQl it worked fine without it!
    end
    
    class RunUpdate  
      def initialize(env = "dev")    
        @env = env
        case @env
        when 'dev'      
          @name = 'att1'
        else
          raise "Unknown environment: #{env}"
        end    
        update_dpp_suplliers
      end
    
      private
      def update_dpp_suplliers
        dpp_supplier = Supplier.where(:num2=>56180).first    
        puts "Reading supplier name before update: #{dpp_supplier.read_attribute(@name)}"
        puts "getting by accessor supplier name before update: #{dpp_supplier.att1}"#got NIL here, nevertheless,there was a value              
      end  
    end
    
    RunUpdate.new('dev')
    

    Here is the stack trace:

    Reading supplier name before update: DP China / Shanghai -   SHENZHOU KNITTING(AN HUI)CO.LTD
    getting by accessor supplier name before update:
    

    Strange, no? Why the 'read_attribute' sends a value and a explicitly defined accessor sends nothing?

  • Javix

    Javix March 16th, 2011 @ 01:05 PM

    I think the problem is that in case if a column name contains a special character, in my case it is a dollar sigh ($), the code in active_model/attribute_methods.rb:271:in `module_eval gets an error.
    Is it possible to solve the issue without 'hacking' the above file?
    Thanks.

  • Javix

    Javix March 16th, 2011 @ 01:32 PM

    I modified the 'define_attribute_methods' in 'activemodel-3.0.5/lib/active_model/' as follows just for 'quick fix':

    def define_attribute_methods(attr_names)
          return if attribute_methods_generated?
          attr_names.each do |attr_name|
            modified_attr_name = attr_name.gsub /[^\w\s]/, ''
            
            attribute_method_matchers.each do |matcher|
              unless instance_method_already_implemented?(matcher.method_name(modified_attr_name))
                generate_method = "define_method_#{matcher.prefix}attribute#{matcher.suffix}"
    
                if respond_to?(generate_method)
                  send(generate_method, modified_attr_name)
                else                     
                  method_name = matcher.method_name(modified_attr_name)
                  generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
                      if method_defined?(:#{method_name})
                        undef :#{method_name}
                      end
                      def #{method_name}(*args)
                        send(:#{matcher.method_missing_target}, '#{modified_attr_name}', *args)
                      end
                  STR
                end
              end
            end
          end
          @attribute_methods_generated = true
        end
    

    It was impossible to call the in-place modifier 'gsub!' on 'attr_name' variable as the String is frozen.
    Is there another way to do that? Shall I have an impact somewhere else?
    Thank you.

  • Santiago Pastorino

    Santiago Pastorino March 17th, 2011 @ 12:33 AM

    • State changed from “new” to “committed”
    • Importance changed from “” to “Low”
  • Javix

    Javix March 17th, 2011 @ 02:39 PM

    I've just copy-pasted the updated version of 'attributes_methods.rb' file and got the below error. In the DB there is a column named ad 'blob$entrysetadhocacl?'.

    Start processing.....................
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:271:in `module_eval': C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:275: formal argument cannot be a global variable (SyntaxError)
                      def blob$entrysetadhocacl?(*args)
                                               ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:275: syntax error, unexpected '?', expecting ';' or '\n'
                      def blob$entrysetadhocacl?(*args)
                                                ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:275: syntax error, unexpected '\n', expecting '='
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:277: syntax error, unexpected keyword_end, expecting $end
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:271:in `block (2 levels) in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:262:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:262:in `block in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:261:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:261:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:13:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:41:in `method_missing'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/relation/batches.rb:75:in `find_in_batches'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/relation/batches.rb:20:in `find_each'
            from C:in `find_each'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:87:in `update_dpp_suplliers'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:64:in `initialize'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:122:in `new'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:122:in `<main>'
    
  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 12:27 AM

    • State changed from “committed” to “open”
    • Milestone set to 3.0.6
    • Assigned user set to “Santiago Pastorino”
  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 12:28 AM

    Javix thanks for your feedback, this will be fixed for 3.0.6, I'm going to push a fix soon.

  • Repository

    Repository March 18th, 2011 @ 02:20 AM

    • State changed from “open” to “committed”

    (from [691530a19d1b335b6e8bc9f4c20c96124625acbe]) Sync attribute_methods.rb with master code, tests added

    [#6580 state:committed] https://github.com/rails/rails/commit/691530a19d1b335b6e8bc9f4c20c9...

  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 02:23 AM

    Javix, please try again and let me know, thanks ;)

  • Javix

    Javix March 18th, 2011 @ 08:09 AM

    Hi Santiago !

    Just checked it again(see the attached file I run) and got the below error:

    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13:in `module_eval': C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: formal argument cannot be a global variable (SyntaxError)
    def blob$entrysetadhocacl=(new_value); write_attribute...
                             ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: syntax error, unexpected '=', expecting ';' or '\n'
    def blob$entrysetadhocacl=(new_value); write_attribute(...
                              ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: syntax error, unexpected keyword_end, expecting $end
    ...rysetadhocacl', new_value); end
    ...                               ^
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13:in `define_method_attribute='
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/time_zone_conversion.rb:51:in `define_method_attribute='
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:264:in `block (2 levels) in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:259:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:259:in `block in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:258:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:258:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:13:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:41:in `method_missing'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:28:in `<main>'
    
  • Javix

    Javix March 18th, 2011 @ 08:09 AM

    • no changes were found...
  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 12:29 PM

    Can you try master and see if it's an error?

  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 12:40 PM

    • State changed from “committed” to “open”

    Nevermind I see where the new problem is, I need an Oracle db to test that.
    OK I will try to fix this today.

  • Javix

    Javix March 18th, 2011 @ 01:09 PM

    I took the 'attribute_methods.rb' file from https://github.com/rails/rails/blob/master/activemodel/lib/active_m....

    Run the same Ruby script and got another error, coming from active-record module now:

    
    Start processing.....................
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/base.rb:1008:in `method_missing': undefined method `attribute_methods_generated?' for #<Class:0x29d59d0> (NoMethodError)
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:40:in `method_missing'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:87:in `update_dpp_suplliers'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:64:in `initialize'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:123:in `new'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf.rb:123:in `<main>'
    

    Regards

  • Javix

    Javix March 18th, 2011 @ 01:12 PM

    Right, I used oracle enhanced adapter: activerecord-oracle_enhanced-adapter (1.3.2), ruby 1.9.2p180 (2011-02-18) [i386-mingw32], rails-3.0.5, all that on Windows XP x64 :(

  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 01:18 PM

    Javix ok we will be testing with Oracle today to see what's going on.
    Thanks for reporting the issue.

  • Santiago Pastorino

    Santiago Pastorino March 18th, 2011 @ 04:54 PM

    Javix can you try this patch file https://gist.github.com/876407 ?
    Tell me what happens I'm making a test case for Oracle to ensure that this doesn't happen again.

  • Santiago Pastorino

    Santiago Pastorino March 19th, 2011 @ 02:11 PM

    Can you show me the schema? I want to know how are you defining lcssupplier ...

  • Javix

    Javix March 19th, 2011 @ 08:33 PM

    Hi Santiago, I'll be able to test the patch next Monday only. I have no Oracle on my Ubuntu OS.
    Second point, as for the DB schema, I don't have it at all. It's not a RoR application. I have to run a Ruby script to make an update in the existing Oracle DB. That's why I have such a strange column name. I had some discussions with Raimonds Simanovskis, the creator of oracle-enhanced adapter, here: http://groups.google.com/group/oracle-enhanced./browse_thread/threa...> You can have a look if needed on what he advised to do.

  • Santiago Pastorino

    Santiago Pastorino March 20th, 2011 @ 04:47 AM

    Javix anyways if you can specify exactly how was lcssupplier defined ... would be great.
    At least tell me the column name and datatype which is causing the issue but the whole stuff about the table would be awesome.

  • Javix

    Javix March 21st, 2011 @ 08:55 AM

    Hi, Santiago!

    I've just testes the patch you posted above with 'attribute_methods.rb' from master. Still get the error:

    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/base.rb:1008:in `method_missing': undefined method `attribute_methods_generated?' for #<Class:0x2898510> (NoMethodError)
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:40:in `method_missing'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:29:in `<main>'
    

    after executing the below code:

    require 'active_record'
    
    ActiveRecord::Base.establish_connection(
      :adapter => 'oracle_enhanced',
      :database => 'db_name',  
      :username => 'username',
      :password => 'pwd'
    )
    
    class Supplier < ActiveRecord::Base 
      set_table_name :lcssupplier  
      set_primary_key :ida2a2     
    end
    
    dpp_supplier = Supplier.where(:num2=>56180).first
    puts "att1 before update: #{dpp_supplier.att1}"
    dpp_supplier.update_attribute(:att1, "DP China / Shanghai - SHENZHOU KNITTING(AN HUI)CO.LTD - yoyo")
    puts "att1 after update: #{dpp_supplier.att1}"
    

    I can list all the available columns in the lcssupplier table with:

    puts dpp_supplier.attribute_names
    

    what gives just:

    atgatestate
    att1
    att10
    att11
    att12
    att13
    att14
    att15
    att16
    att17
    att18
    att19
    att2
    att20
    att21
    att22
    att23
    att24
    att25
    att26
    att27
    att28
    att29
    att3
    att30
    att4
    att5
    att6
    att7
    att8
    att9
    blob$entrysetadhocacl
    branchiditerationinfo
    checkoutinfoisnull
    classnamea2a2
    classnamekeya10
    classnamekeya2checkoutinfo
    classnamekeya2folderinginfo
    classnamekeya2lock
    classnamekeya2ownership
    classnamekeya2state
    classnamekeyb10
    classnamekeyb2folderinginfo
    classnamekeyb2iterationinfo
    classnamekeyc2iterationinfo
    classnamekeycontainerreferen
    classnamekeyd2iterationinfo
    classnamekeydomainref
    classnamekeymasterreference
    classnamekeyteamid
    classnamekeyteamtemplateid
    createstampa2
    date1
    date10
    date2
    date3
    date4
    date5
    date6
    date7
    date8
    date9
    datelock
    entrysetadhocacl
    eventset
    flextypeidpath
    ida2a2
    ida3a10
    ida3a2checkoutinfo
    ida3a2folderinginfo
    ida3a2lock
    ida3a2ownership
    ida3a2state
    ida3b10
    ida3b2folderinginfo
    ida3b2iterationinfo
    ida3c2iterationinfo
    ida3containerreference
    ida3d2iterationinfo
    ida3domainref
    ida3masterreference
    ida3teamid
    ida3teamtemplateid
    indexersindexerset
    inheriteddomain
    iterationida2iterationinfo
    latestiterationinfo
    markfordeletea2
    modifystampa2
    nameb2folderinginfo
    noteiterationinfo
    notelock
    num1
    num10
    num11
    num12
    num13
    num14
    num15
    num16
    num17
    num18
    num19
    num2
    num20
    num3
    num4
    num5
    num6
    num7
    num8
    num9
    primaryimageurl
    securitylabels
    statecheckoutinfo
    stateiterationinfo
    statestate
    teamidisnull
    teamtemplateidisnull
    typedisplay
    updatecounta2
    updatestampa2
    versionida2versioninfo
    versionlevela2versioninfo
    versionsortida2versioninfo
    

    Is there a way to list all the columns and their types as well in Ruby? If not I'll ask our DBA.

  • Javix

    Javix March 21st, 2011 @ 12:19 PM

    and here are columns and their data types:

    ATT1                         VARCHAR2(4000),
      ATT10                        VARCHAR2(4000),
      ATT11                        VARCHAR2(4000),
      ATT12                        VARCHAR2(4000),
      ATT13                        VARCHAR2(4000),
      ATT14                        VARCHAR2(4000),
      ATT15                        VARCHAR2(4000),
      ATT16                        VARCHAR2(4000),
      ATT17                        VARCHAR2(4000),
      ATT18                        VARCHAR2(4000),
      ATT19                        VARCHAR2(4000),
      ATT2                         VARCHAR2(4000),
      ATT20                        VARCHAR2(4000),
      ATT21                        VARCHAR2(4000),
      ATT22                        VARCHAR2(4000),
      ATT23                        VARCHAR2(4000),
      ATT24                        VARCHAR2(4000),
      ATT25                        VARCHAR2(4000),
      ATT26                        VARCHAR2(4000),
      ATT27                        VARCHAR2(4000),
      ATT28                        VARCHAR2(4000),
      ATT29                        VARCHAR2(4000),
      ATT3                         VARCHAR2(4000),
      ATT30                        VARCHAR2(4000),
      ATT4                         VARCHAR2(4000),
      ATT5                         VARCHAR2(4000),
      ATT6                         VARCHAR2(4000),
      ATT7                         VARCHAR2(4000),
      ATT8                         VARCHAR2(4000),
      ATT9                         VARCHAR2(4000),
      BLOB$ENTRYSETADHOCACL        BLOB,
      CHECKOUTINFOISNULL           NUMBER(1),
      CLASSNAMEKEYA2CHECKOUTINFO   VARCHAR2(600),
      IDA3A2CHECKOUTINFO           NUMBER,
      STATECHECKOUTINFO            VARCHAR2(90) not null,
      CLASSNAMEKEYCONTAINERREFEREN VARCHAR2(600),
      IDA3CONTAINERREFERENCE       NUMBER,
      CLASSNAMEKEYB10              VARCHAR2(600),
      IDA3B10                      NUMBER,
      DATE1                        DATE,
      DATE10                       DATE,
      DATE2                        DATE,
      DATE3                        DATE,
      DATE4                        DATE,
      DATE5                        DATE,
      DATE6                        DATE,
      DATE7                        DATE,
      DATE8                        DATE,
      DATE9                        DATE,
      CLASSNAMEKEYDOMAINREF        VARCHAR2(600),
      IDA3DOMAINREF                NUMBER,
      ENTRYSETADHOCACL             VARCHAR2(4000),
      EVENTSET                     VARCHAR2(4000),
      FLEXTYPEIDPATH               VARCHAR2(600),
      CLASSNAMEKEYA10              VARCHAR2(600),
      IDA3A10                      NUMBER,
      CLASSNAMEKEYA2FOLDERINGINFO  VARCHAR2(600),
      IDA3A2FOLDERINGINFO          NUMBER,
      CLASSNAMEKEYB2FOLDERINGINFO  VARCHAR2(600),
      IDA3B2FOLDERINGINFO          NUMBER,
      NAMEB2FOLDERINGINFO          VARCHAR2(600),
      INDEXERSINDEXERSET           VARCHAR2(4000),
      INHERITEDDOMAIN              NUMBER(1),
      BRANCHIDITERATIONINFO        NUMBER,
      CLASSNAMEKEYD2ITERATIONINFO  VARCHAR2(600),
      IDA3D2ITERATIONINFO          NUMBER,
      ITERATIONIDA2ITERATIONINFO   VARCHAR2(180),
      LATESTITERATIONINFO          NUMBER(1),
      CLASSNAMEKEYB2ITERATIONINFO  VARCHAR2(600),
      IDA3B2ITERATIONINFO          NUMBER,
      NOTEITERATIONINFO            VARCHAR2(4000),
      CLASSNAMEKEYC2ITERATIONINFO  VARCHAR2(600),
      IDA3C2ITERATIONINFO          NUMBER,
      STATEITERATIONINFO           VARCHAR2(90) not null,
      DATELOCK                     DATE,
      CLASSNAMEKEYA2LOCK           VARCHAR2(600),
      IDA3A2LOCK                   NUMBER,
      NOTELOCK                     VARCHAR2(4000),
      CLASSNAMEKEYMASTERREFERENCE  VARCHAR2(600),
      IDA3MASTERREFERENCE          NUMBER,
      NUM1                         NUMBER,
      NUM10                        NUMBER,
      NUM11                        NUMBER,
      NUM12                        NUMBER,
      NUM13                        NUMBER,
      NUM14                        NUMBER,
      NUM15                        NUMBER,
      NUM16                        NUMBER,
      NUM17                        NUMBER,
      NUM18                        NUMBER,
      NUM19                        NUMBER,
      NUM2                         NUMBER,
      NUM20                        NUMBER,
      NUM3                         NUMBER,
      NUM4                         NUMBER,
      NUM5                         NUMBER,
      NUM6                         NUMBER,
      NUM7                         NUMBER,
      NUM8                         NUMBER,
      NUM9                         NUMBER,
      CLASSNAMEKEYA2OWNERSHIP      VARCHAR2(600),
      IDA3A2OWNERSHIP              NUMBER,
      PRIMARYIMAGEURL              VARCHAR2(600),
      SECURITYLABELS               VARCHAR2(4000),
      ATGATESTATE                  NUMBER(1),
      CLASSNAMEKEYA2STATE          VARCHAR2(600),
      IDA3A2STATE                  NUMBER,
      STATESTATE                   VARCHAR2(600) not null,
      TEAMIDISNULL                 NUMBER(1),
      CLASSNAMEKEYTEAMID           VARCHAR2(600),
      IDA3TEAMID                   NUMBER,
      TEAMTEMPLATEIDISNULL         NUMBER(1),
      CLASSNAMEKEYTEAMTEMPLATEID   VARCHAR2(600),
      IDA3TEAMTEMPLATEID           NUMBER,
      CREATESTAMPA2                DATE,
      MARKFORDELETEA2              NUMBER not null,
      MODIFYSTAMPA2                DATE,
      CLASSNAMEA2A2                VARCHAR2(600),
      IDA2A2                       NUMBER not null,
      UPDATECOUNTA2                NUMBER,
      UPDATESTAMPA2                DATE,
      TYPEDISPLAY                  VARCHAR2(600),
      VERSIONIDA2VERSIONINFO       VARCHAR2(180),
      VERSIONLEVELA2VERSIONINFO    NUMBER,
      VERSIONSORTIDA2VERSIONINFO   VARCHAR2(600)
    
  • Santiago Pastorino

    Santiago Pastorino March 22nd, 2011 @ 11:25 PM

    Javix should be working now, can you test it with Oracle though?.
    Let me know.

  • Javix

    Javix March 23rd, 2011 @ 08:35 AM

    Santiago, which version and which files should I take, please?

  • Javix

    Javix March 23rd, 2011 @ 08:48 AM

    I saw your 3 commits at master:
    - activemodel/lib/active_model/attribute_methods.rb - activerecord/lib/active_record/attribute_methods/read.rb - activerecord/lib/active_record/attribute_methods/write.rb

    Correct? Should I take these files for testing ? Thanks

  • Javix

    Javix March 23rd, 2011 @ 09:51 AM

    Still no luck. I tried the 3 files you committed (see above) and got the below error:

    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/base.rb:1008:in `method_missing': undefined method `attribute_methods_generated?' for #<Class:0x288e880> (NoMethodError)
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:40:in `method_missing'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:29:in `<main>'
    
  • Santiago Pastorino

    Santiago Pastorino March 23rd, 2011 @ 01:57 PM

    You should go against 3-0-stable.

  • Santiago Pastorino
  • Javix

    Javix March 23rd, 2011 @ 02:42 PM

    Just these 3 commits and no need to take the modified ?

    activemodel/lib/active_model/attribute_methods.rb 
    activerecord/lib/active_record/attribute_methods/read.rb 
    activerecord/lib/active_record/attribute_methods/write.rb
    
  • Santiago Pastorino

    Santiago Pastorino March 23rd, 2011 @ 02:49 PM

    I think the best way for you is to point your Gemfile to rails 3-0-stable on edge ...

    so change this ...

    gem 'rails', '3.0.5'

    with this ...

    gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-0-stable'

  • Javix

    Javix March 23rd, 2011 @ 02:52 PM

    As I pointed before it is NOT a Rails application, so I have no Gemfile to define it. I'm just running a Ruby file (see attached before) :).
    By the the way without the modifications made previously in the below files

    activemodel/lib/active_model/attribute_methods.rb 
    activerecord/lib/active_record/attribute_methods/read.rb 
    activerecord/lib/active_record/attribute_methods/write.rb
    

    it doen(t work neither :(

  • Santiago Pastorino

    Santiago Pastorino March 23rd, 2011 @ 03:08 PM

    so you downloaded those files from 3-0-stable and still doesn't work?
    Paste me the backtrace

  • Javix

    Javix March 23rd, 2011 @ 03:35 PM

    Yes, I came back to the original rails-3.0.5 version, downloaded the THREE file you posted before:

    https://github.com/rails/rails/commit/7717fc375ee45d7cb1fa1672713ab8c883a833ef
    https://github.com/rails/rails/commit/1b7b7243062519a58286cf88411bec69cd84fa24
    https://github.com/rails/rails/commit/63dca41fb62f47d257fd778371dc9cef0fb4181e
    

    pasted them in the corresponding places of my Ruby installation folder (saved the previous versions before) and after running got the error I think I had in the very beginning:

    
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13:in `module_eval': C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: formal argument cannot be a global variable (SyntaxError)
    def blob$entrysetadhocacl=(new_value); write_attribute...
                             ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: syntax error, unexpected '=', expecting ';' or '\n'
    def blob$entrysetadhocacl=(new_value); write_attribute(...
                              ^
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13: syntax error, unexpected keyword_end, expecting $end
    ...rysetadhocacl', new_value); end
    ...                               ^
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/write.rb:13:in `define_method_attribute='
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods/time_zone_conversion.rb:51:in `define_method_attribute='
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:264:in `block (2 levels) in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:259:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:259:in `block in define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:258:in `each'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:258:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:13:in `define_attribute_methods'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:41:in `method_missing'
            from C:/Documents and Settings/MACHINE_DEV3/My Documents/ror_prj/ruby_drafts/lib/update_cnuf_1.rb:29:in `<main>'
    
  • Santiago Pastorino

    Santiago Pastorino March 24th, 2011 @ 12:00 AM

    Hey Javix, why don't you just clone rails from with instead of patching file by file?.
    The write file you are using is outdated, the right file has this ...

    def define_method_attribute=(attr_name)
      if attr_name =~ /^[a-zA-Z_]\w*[!?=]?$/
        generated_attribute_methods.module_eval("def #{attr_name}=(new_value); write_attribute('#{attr_name}', new_value); end", __FILE__, __LINE__)
      else
        generated_attribute_methods.send(:define_method, "#{attr_name}=") do |new_value|
          write_attribute(attr_name, new_value)
        end
      end
    end
    

    Also we can chat on IRC #rails-contrib channel I'm spastorino

  • Javix

    Javix March 24th, 2011 @ 08:08 AM

    Unfortunately, I'm on Windows x64, behind a proxy - all that makes it impossible to use git and to make a clone.
    I just installed Ruby 1.9.2 and rails (by default it's the latest version that is installed, - 3.0.5 in in case).
    I think that the best solution would be to install the Rails version yo will tell me. Is it 3-0-stable ? If so I can try to install just like that:

    gem install rails -v 3-0-stable
    

    regards

  • Santiago Pastorino
  • Javix

    Javix March 24th, 2011 @ 02:31 PM

    I downloaded the below files and copy-pasted them instead of ones got with 3.0.5 version:
    https://github.com/rails/rails/blob/2-3-stable/activerecord/lib/act...
    https://github.com/rails/rails/raw/3-0-stable/activemodel/lib/activ...
    https://github.com/rails/rails/raw/3-0-stable/activerecord/lib/acti...
    https://github.com/rails/rails/raw/3-0-stable/activerecord/lib/acti...

    and it works !!!!!!!!
    Thanks a lot, I hope the above modifications will be merged very soon to be avilable when running 'gem install rails' command.

  • Santiago Pastorino

    Santiago Pastorino March 24th, 2011 @ 02:50 PM

    • State changed from “open” to “resolved”

    Ok this will be fixed for 3.0.6 that will be released by the end of the month

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages