Getting this error: SyntaxError in CompanyController#positionslist (eval):1:in `compute_type'': compile error (eval):1: parse error, unexpected tINTEGER Object::2 I could not find anything out about it (googling) and it''s not the clearest error message. Not sure if it''s related to an expected data type but that wouldn''t make sense. The only other thing I can think of is the view only has place holders for 6 of the 12 columns. Think it''s 12 :). <tr> <td><%= (position.title) %></td> <td><%= (position.category.name) %></td> <td><%= (position.comapny_id) %></td> <td><%= (position.city) %></td> <td><%= (position.state.name) %></td> <td><%= (position.entered_on_date) %></td> </tr> Here is the method in the controller: def positionslist @positions = (Position.find_all) end The model: class Position < ActiveRecord::Base belongs_to :category belongs_to :contactmethod belongs_to :edureq belongs_to :expreq belongs_to :postlength belongs_to :securityclear belongs_to :state def self.find_all find(:all) end end Maybe something jumps out at someone ? TIA Stuart
I believe that views want strings passed to them in the <%= %> option 1. <%= some.value.to_s -%> option 2. <%= "#{somel.value}" %> Hopefully that will fix it. On 6/22/06, Dark Ambient <sambient@gmail.com> wrote:> > Getting this error: > > SyntaxError in CompanyController#positionslist > (eval):1:in `compute_type'': compile error > (eval):1: parse error, unexpected tINTEGER > Object::2 > > I could not find anything out about it (googling) and it''s not the > clearest error message. Not sure if it''s related to an expected data > type but that wouldn''t make sense. The only other thing I can think > of is the view only has place holders for 6 of the 12 columns. Think > it''s 12 :). > <tr> > <td><%= (position.title) %></td> > <td><%= (position.category.name) %></td> > <td><%= (position.comapny_id) %></td> > <td><%= (position.city) %></td> > <td><%= (position.state.name) %></td> > <td><%= (position.entered_on_date) %></td> > </tr> > > Here is the method in the controller: > def positionslist > @positions = (Position.find_all) > end > > The model: > class Position < ActiveRecord::Base > belongs_to :category > belongs_to :contactmethod > belongs_to :edureq > belongs_to :expreq > belongs_to :postlength > belongs_to :securityclear > belongs_to :state > > > def self.find_all > find(:all) > end > > end > > Maybe something jumps out at someone ? > > TIA > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060622/59b5c23a/attachment.html
Hey Stuart, with the error dump you supplied it''s hard to tell what''s up, but your code looks a little suspicious: 1. the view references position, not @positions (I gather is a partial :collection => @positions ?) 2. but the Class method find_all is most "disturbing". Position.find_all is already defined by AR - even if you''re overriding, it''s defined incorrectly (I think), should be: def self.find_all Position.find(:all) end I''d just kill it entirely, unless you''re intending on juicing it up with more code. Those are just a couple of thoughts Stuart that I hope help. If you can provide a stack trace from the development.log we''ll have a better chance helping out. Jodi On 21-Jun-06, at 8:29 PM, Dark Ambient wrote:> Getting this error: > > SyntaxError in CompanyController#positionslist > (eval):1:in `compute_type'': compile error > (eval):1: parse error, unexpected tINTEGER > Object::2 > > I could not find anything out about it (googling) and it''s not the > clearest error message. Not sure if it''s related to an expected data > type but that wouldn''t make sense. The only other thing I can think > of is the view only has place holders for 6 of the 12 columns. Think > it''s 12 :). > <tr> > <td><%= (position.title) %></td> > <td><%= (position.category.name) %></td> > <td><%= (position.comapny_id) %></td> > <td><%= (position.city) %></td> > <td><%= (position.state.name) %></td> > <td><%= (position.entered_on_date) %></td> > </tr> > > Here is the method in the controller: > def positionslist > @positions = (Position.find_all) > end > > The model: > class Position < ActiveRecord::Base > belongs_to :category > belongs_to :contactmethod > belongs_to :edureq > belongs_to :expreq > belongs_to :postlength > belongs_to :securityclear > belongs_to :state > > > def self.find_all > find(:all) > end > > end > > Maybe something jumps out at someone ? > > TIA > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
You''ve got a typo somewhere else in your controller. Try posting the code for the entire controller and I''ll see if I can spot the problem. On 22/06/2006, at 10:29 AM, Dark Ambient wrote:> Getting this error: > > SyntaxError in CompanyController#positionslist > (eval):1:in `compute_type'': compile error > (eval):1: parse error, unexpected tINTEGER > Object::2 > > I could not find anything out about it (googling) and it''s not the > clearest error message. Not sure if it''s related to an expected data > type but that wouldn''t make sense. The only other thing I can think > of is the view only has place holders for 6 of the 12 columns. Think > it''s 12 :). > <tr> > <td><%= (position.title) %></td> > <td><%= (position.category.name) %></td> > <td><%= (position.comapny_id) %></td> > <td><%= (position.city) %></td> > <td><%= (position.state.name) %></td> > <td><%= (position.entered_on_date) %></td> > </tr> > > Here is the method in the controller: > def positionslist > @positions = (Position.find_all) > end > > The model: > class Position < ActiveRecord::Base > belongs_to :category > belongs_to :contactmethod > belongs_to :edureq > belongs_to :expreq > belongs_to :postlength > belongs_to :securityclear > belongs_to :state > > > def self.find_all > find(:all) > end > > end > > Maybe something jumps out at someone ? > > TIA > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On 6/21/06, Jodi Showers <jodi@nnovation.ca> wrote:> Hey Stuart, with the error dump you supplied it''s hard to tell what''s > up, but your code looks a little suspicious: > > 1. the view references position, not @positions (I gather is a > partial :collection => @positions ?)I''m still investigating this but it wasn''t intended or set up as a partial.> 2. but the Class method find_all is most "disturbing". > Position.find_all is already defined by AR - even if you''re > overriding, it''s defined incorrectly (I think), > > should be: > > def self.find_all > Position.find(:all) > end > > I''d just kill it entirely, unless you''re intending on juicing it up > with more code. > > Those are just a couple of thoughts Stuart that I hope help. If you > can provide a stack trace from the development.log we''ll have a > better chance helping out. > > Jodi >Here is the stack trace: SyntaxError ((eval):1:in `compute_type'': compile error (eval):1: parse error, unexpected tINTEGER Object::2 ^): C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1244:in `compute_type'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:983:in `instantiate_without_callbacks'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:215:in `instantiate'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in `find_by_sql'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:390:in `find_by_sql'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:924:in `find_every'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:381:in `find'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/deprecated_finders.rb:37:in `find_all'' /app/controllers/company_controller.rb:5:in `positionslist'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in `perform_action_without_filters'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in `perform_action'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in `process_without_filters'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_without_session_management_support'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in `handle_dispatch'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in `service'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in `dispatch'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' script/server:3> On 21-Jun-06, at 8:29 PM, Dark Ambient wrote: > > > Getting this error: > > > > SyntaxError in CompanyController#positionslist > > (eval):1:in `compute_type'': compile error > > (eval):1: parse error, unexpected tINTEGER > > Object::2 > > > > I could not find anything out about it (googling) and it''s not the > > clearest error message. Not sure if it''s related to an expected data > > type but that wouldn''t make sense. The only other thing I can think > > of is the view only has place holders for 6 of the 12 columns. Think > > it''s 12 :). > > <tr> > > <td><%= (position.title) %></td> > > <td><%= (position.category.name) %></td> > > <td><%= (position.comapny_id) %></td> > > <td><%= (position.city) %></td> > > <td><%= (position.state.name) %></td> > > <td><%= (position.entered_on_date) %></td> > > </tr> > > > > Here is the method in the controller: > > def positionslist > > @positions = (Position.find_all) > > end > > > > The model: > > class Position < ActiveRecord::Base > > belongs_to :category > > belongs_to :contactmethod > > belongs_to :edureq > > belongs_to :expreq > > belongs_to :postlength > > belongs_to :securityclear > > belongs_to :state > > > > > > def self.find_all > > find(:all) > > end > > > > end > > > > Maybe something jumps out at someone ? > > > > TIA > > Stuart > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
There isn''t much to the controller. class CompanyController < ApplicationController scaffold :position def positionslist @positions = (Position.find_all) end end Stuart On 6/21/06, Pete Yandell <pete@notahat.com> wrote:> You''ve got a typo somewhere else in your controller. Try posting the > code for the entire controller and I''ll see if I can spot the problem. > > On 22/06/2006, at 10:29 AM, Dark Ambient wrote: > > > Getting this error: > > > > SyntaxError in CompanyController#positionslist > > (eval):1:in `compute_type'': compile error > > (eval):1: parse error, unexpected tINTEGER > > Object::2 > > > > I could not find anything out about it (googling) and it''s not the > > clearest error message. Not sure if it''s related to an expected data > > type but that wouldn''t make sense. The only other thing I can think > > of is the view only has place holders for 6 of the 12 columns. Think > > it''s 12 :). > > <tr> > > <td><%= (position.title) %></td> > > <td><%= (position.category.name) %></td> > > <td><%= (position.comapny_id) %></td> > > <td><%= (position.city) %></td> > > <td><%= (position.state.name) %></td> > > <td><%= (position.entered_on_date) %></td> > > </tr> > > > > Here is the method in the controller: > > def positionslist > > @positions = (Position.find_all) > > end > > > > The model: > > class Position < ActiveRecord::Base > > belongs_to :category > > belongs_to :contactmethod > > belongs_to :edureq > > belongs_to :expreq > > belongs_to :postlength > > belongs_to :securityclear > > belongs_to :state > > > > > > def self.find_all > > find(:all) > > end > > > > end > > > > Maybe something jumps out at someone ? > > > > TIA > > Stuart > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Sorri for my short post before... I''m at work and, well you know... On 6/22/06, Dark Ambient <sambient@gmail.com> wrote:> > Getting this error: > > SyntaxError in CompanyController#positionslist > (eval):1:in `compute_type'': compile error > (eval):1: parse error, unexpected tINTEGER > Object::2 > > I could not find anything out about it (googling) and it''s not the > clearest error message. Not sure if it''s related to an expected data > type but that wouldn''t make sense. The only other thing I can think > of is the view only has place holders for 6 of the 12 columns. Think > it''s 12 :). > <tr> > <td><%= (position.title) %></td> > <td><%= (position.category.name) %></td> > <td><%= (position.comapny_id) %></td> > <td><%= (position.city) %></td> > <td><%= (position.state.name) %></td> > <td><%= (position.entered_on_date) %></td> > </tr>In here assuming that in the view you have something like <% @positions.each do |position| %> <tr> <td><%= position.title %> </td> <td><%= position.category.name %> </td> <td><%= "#{position.comapny_id}" %> </td> <td><%= "#{position.city}" %> </td> <td><%= position.state.name %> </td> <td><%= "#{position.entered_on_date.to_date}" %></td> </tr> <% end %> I have made modifications I believe may help you. Here is the method in the controller:> def positionslist > @positions = (Position.find_all) > end > > The model: > class Position < ActiveRecord::Base > belongs_to :category > belongs_to :contactmethod > belongs_to :edureq > belongs_to :expreq > belongs_to :postlength > belongs_to :securityclear > belongs_to :stateI would include some validation here. validates_presence_of :entered_on_date validates_presence_of :city validates_associated :state validates_associated :category By including these things you won''t have to worry in your view if something is nil or not. Alternatively you could put unless (object to go between <%%>).nil? eg <td><%= position.state.name unless position.state.nil? %> </td> def self.find_all> find(:all) > end > > end > > Maybe something jumps out at someone ? > > TIA > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >I hope that this will assist with your problem. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060622/f02d5c81/attachment.html
Stuart, google says: http://lists.rubyonrails.org/pipermail/rails/2006-April/033467.html Do you by chance have a field named ''type'' in one of your tables? Seems it''s a reserved word and compute_type will choke on it. Jodi On 21-Jun-06, at 9:52 PM, Dark Ambient wrote:> On 6/21/06, Jodi Showers <jodi@nnovation.ca> wrote: >> Hey Stuart, with the error dump you supplied it''s hard to tell what''s >> up, but your code looks a little suspicious: >> >> 1. the view references position, not @positions (I gather is a >> partial :collection => @positions ?) > > I''m still investigating this but it wasn''t intended or set up as a > partial. > >> 2. but the Class method find_all is most "disturbing". >> Position.find_all is already defined by AR - even if you''re >> overriding, it''s defined incorrectly (I think), >> >> should be: >> >> def self.find_all >> Position.find(:all) >> end >> >> I''d just kill it entirely, unless you''re intending on juicing it up >> with more code. >> >> Those are just a couple of thoughts Stuart that I hope help. If you >> can provide a stack trace from the development.log we''ll have a >> better chance helping out. >> >> Jodi >> > Here is the stack trace: > > SyntaxError ((eval):1:in `compute_type'': compile error > (eval):1: parse error, unexpected tINTEGER > Object::2 > ^): > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:1244:in > `compute_type'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:983:in > `instantiate_without_callbacks'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/callbacks.rb:215:in > `instantiate'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:390:in > `find_by_sql'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:390:in > `find_by_sql'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:924:in > `find_every'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/base.rb:381:in > `find'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ > active_record/deprecated_finders.rb:37:in > `find_all'' > /app/controllers/company_controller.rb:5:in `positionslist'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/base.rb:910:in > `perform_action_without_filters'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/filters.rb:368:in > `perform_action_without_benchmark'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/rescue.rb:82:in > `perform_action'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/base.rb:381:in > `process_without_filters'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/filters.rb:377:in > `process_without_session_management_support'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/ > action_controller/session_management.rb:117:in > `process'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/ > dispatcher.rb:38:in > `dispatch'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/ > webrick_server.rb:115:in > `handle_dispatch'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/ > webrick_server.rb:81:in > `service'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in > `service'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:173:in > `start_thread'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:162:in > `start_thread'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' > C:/INSTAN~1/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/ > webrick_server.rb:67:in > `dispatch'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/ > servers/webrick.rb:59 > C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/ > custom_require.rb:21:in > `require'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ > active_support/dependencies.rb:147:in > `require'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/ > server.rb:30 > C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/ > custom_require.rb:21:in > `require'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ > active_support/dependencies.rb:147:in > `require'' > script/server:3 > > >> On 21-Jun-06, at 8:29 PM, Dark Ambient wrote: >> >> > Getting this error: >> > >> > SyntaxError in CompanyController#positionslist >> > (eval):1:in `compute_type'': compile error >> > (eval):1: parse error, unexpected tINTEGER >> > Object::2 >> > >> > I could not find anything out about it (googling) and it''s not the >> > clearest error message. Not sure if it''s related to an expected >> data >> > type but that wouldn''t make sense. The only other thing I can >> think >> > of is the view only has place holders for 6 of the 12 columns. >> Think >> > it''s 12 :). >> > <tr> >> > <td><%= (position.title) %></td> >> > <td><%= (position.category.name) %></td> >> > <td><%= (position.comapny_id) %></td> >> > <td><%= (position.city) %></td> >> > <td><%= (position.state.name) %></td> >> > <td><%= (position.entered_on_date) %></td> >> > </tr> >> > >> > Here is the method in the controller: >> > def positionslist >> > @positions = (Position.find_all) >> > end >> > >> > The model: >> > class Position < ActiveRecord::Base >> > belongs_to :category >> > belongs_to :contactmethod >> > belongs_to :edureq >> > belongs_to :expreq >> > belongs_to :postlength >> > belongs_to :securityclear >> > belongs_to :state >> > >> > >> > def self.find_all >> > find(:all) >> > end >> > >> > end >> > >> > Maybe something jumps out at someone ? >> > >> > TIA >> > Stuart >> > _______________________________________________ >> > Rails mailing list >> > Rails@lists.rubyonrails.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On 6/21/06, Daniel N <has.sox@gmail.com> wrote:> Sorri for my short post before... I''m at work and, well you know...No apologies necessary, totally appreciate any help I get.>> > <tr> > > <td><%= (position.title) %></td> > > <td><%= (position.category.name) %></td> > > <td><%= (position.comapny_id) %></td> > > <td><%= (position.city) %></td> > > <td><%= (position.state.name) %></td> > > <td><%= (position.entered_on_date) %></td> > > </tr> > > > In here assuming that in the view you have something like > <% @positions.each do |position| %>I appreciate the confidence but sadly enough it''s not in there , and that is an important part of getting rows returned. My apologies. I''m not at the machine right now but this will be the first place to start.> <tr> > <td><%= position.title %> > </td> > <td><%= position.category.name %> </td> > <td><%= "#{position.comapny_id}" %> </td> > <td><%= "#{position.city}" %> > </td> > <td><%= position.state.name %> </td> > <td><%= "#{position.entered_on_date.to_date}" %></td> > </tr> > <% end %> > > I have made modifications I believe may help you.Are you showing examples for the string interpolation or you think those particular fields would require it ?> > Here is the method in the controller: > > def positionslist > > @positions = (Position.find_all) > > end > > > > The model: > > class Position < ActiveRecord::Base > > belongs_to :category > > belongs_to :contactmethod > > belongs_to :edureq > > belongs_to :expreq > > belongs_to :postlength > > belongs_to :securityclear > > belongs_to :state > > > I would include some validation here. > > validates_presence_of :entered_on_date > validates_presence_of :city > validates_associated :state > validates_associated :category > > By including these things you won''t have to worry in your view if something > is nil or not. Alternatively you could put unless (object to go between <%> %>).nil? eg > <td><%= position.state.name unless position.state.nil? %> > </td> >Will do, I was holding off until I created the funnctions for creating and editing to the table. This is just a list.> def self.find_all > find(:all) > end > > end > > Maybe something jumps out at someone ? >I''ll have to make sure I have Active Record::Base reference opened when I get back to this. Stuart
On 6/22/06, Dark Ambient <sambient@gmail.com> wrote:> > On 6/21/06, Daniel N <has.sox@gmail.com> wrote: > > Sorri for my short post before... I''m at work and, well you know... > > No apologies necessary, totally appreciate any help I get. > > > > > > > <tr> > > > <td><%= (position.title) %></td> > > > <td><%= (position.category.name) %></td> > > > <td><%= (position.comapny_id) %></td> > > > <td><%= (position.city) %></td> > > > <td><%= (position.state.name ) %></td> > > > <td><%= (position.entered_on_date) %></td> > > > </tr> > > > > > > In here assuming that in the view you have something like > > <% @ positions.each do |position| %> > > I appreciate the confidence but sadly enough it''s not in there , and > that is an important part of getting rows returned. My apologies. I''m > not at the machine right now but this will be the first place to > start.If that @postions.each do |position| is not in your view, or you don''t have a line that looks like , <%= render :partial => ''position'', :collection => @positions %> Then there is not a usual way for looping through the list of positions in your views. Unless you have some kind of loop construct that sets up the local positionor you have specifically set it up, it will not be set in your view. Since you''re not getting a nil error I don''t think this is an error. It must be looping somewhere.> <tr> > > <td><%= position.title %> > > </td> > > <td><%= position.category.name%> </td> > > <td><%= "#{position.comapny_id}" %> </td> > > <td><%= "#{position.city}" %> > > </td> > > <td><%= position.state.name %> </td> > > <td><%= "#{position.entered_on_date.to_date}" %></td> > > </tr> > > <% end %> > > > > I have made modifications I believe may help you. > > Are you showing examples for the string interpolation or you think > those particular fields would require it ?Yes, I''m showing the fields that I think will require interpolation. If it''s not a string, you need to make it one. (at least that''s my understanding of erb)> > Here is the method in the controller: > > > def positionslist > > > @positions = (Position.find_all) > > > end > > > > > > The model: > > > class Position < ActiveRecord::Base > > > belongs_to :category > > > belongs_to :contactmethod > > > belongs_to :edureq > > > belongs_to :expreq > > > belongs_to :postlength > > > belongs_to :securityclear > > > belongs_to :state > > > > > > I would include some validation here. > > > > validates_presence_of :entered_on_date > > validates_presence_of :city > > validates_associated :state > > validates_associated :category > > > > By including these things you won''t have to worry in your view if > something > > is nil or not. Alternatively you could put unless (object to go between > <%> > %>).nil? eg > > <td><%= position.state.name unless position.state.nil? %> > > </td> > > > Will do, I was holding off until I created the funnctions for creating > and editing to the table. This is just a list. > > > def self.find_all > > find(:all) > > end > > > > end > > > > Maybe something jumps out at someone ? > > > I''ll have to make sure I have Active Record::Base reference opened > when I get back to this. > > > Stuart > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060622/8e56245d/attachment-0001.html
Hi, Everyone may already know the answer to this one. I''m fairly sure it''s either fiendishly obvious or devilishly simple. All I want to do is use ActionMailer to send an email address from a contact form to a couple of email addresses in the same domain. I''m thinking this goal could be satisfied in a couple lines, but yet I am stymied. My app''s going up on TextDrive, if that matters. Any mail wizards out there? TIA, Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060622/1e2c3928/attachment.html
Hi Stephen, This guide is a good starting point: http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer There are even a few specific tips for TextDrive users. Also, in general the wiki has lots of useful info like this so if you haven''t checked it out I highly recommend it. I am also hosting my apps on TextDrive and I have created a very similar contact form to the one you described so if you run into any speed bumps feel free to ask me. Tom On 6/22/06, Stephen Smith <4fires@gmail.com> wrote:> Hi, > > Everyone may already know the answer to this one. I''m fairly sure it''s > either fiendishly obvious or devilishly simple. > > All I want to do is use ActionMailer to send an email address from a contact > form to a couple of email addresses in the same domain. > > I''m thinking this goal could be satisfied in a couple lines, but yet I am > stymied. > > My app''s going up on TextDrive, if that matters. > > Any mail wizards out there? > > TIA, > Steve > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Tom Davies http://atomgiant.com http://gifthat.com