2009/9/3 RVince <[email protected]>:
>
> Guys, Ok here is the code (I changed the class  names and simplified
> in what I sent earlier -- here is the exact code)
> class ChannelsController < ApplicationController
> ..
>  def cxl
>    boxchangedata
>    offToServer params['id'].to_i,current_associate.username, " ",
> "Cxl",params['channelnotes']
>        puts params['cxlidx']
>        if params['cxlidx'] == "0"
>                Channelnote cnote = Channelnote.new

As Fred pointed out this is not C++, it should be
cnote = Channelnote.new
I kept doing that at first also.

>                cnote.note = params['channelnotes']
>                cnote.channel_id = @channel.id
>                cnote.associate_id = current_associate.id

The usual way to do this sort of thing is using the ActiveRecord
relationships, then Rails does all this messy stuff for you.  You
should only very rarely have to mess about with id values.  See the
rails guide on ActiveRecord relationships.

Colin

>                g=cnote.save
>                puts "***"+g.to_s
>        end
>    render :partial => 'channelnotesfield' # to repop the box
>  end
> ...
> end
>
> (Channelnote is MyB in the previous). Here is the (exact) error I am
> getting from the log:
>
> NoMethodError (undefined method `Channelnote' for #<ChannelsController:
> 0x671df1c>):
>  app/controllers/channels_controller.rb:170:in `cxl'
>
> Thanks for looking at this for me guys -- I'm just confused about why
> this won't write a Channelnote record here. -Rvince
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to