Checked that, it does work fine without and with updated_by. Just doesn't populate the user_id column
On Sep 12, 12:18 pm, radhames brito <[email protected]> wrote: > first see if ti works without updated_by > > > > On Sun, Sep 12, 2010 at 1:42 PM, nobosh <[email protected]> wrote: > > Quick update... I think what I've been doing wrong is not including > > the updated_by current_user in the right place... I now have: > > > def update > > �...@book = Book.find(params[:id]) > > respond_to do |format| > > if @book.update_attributes(params[:book].merge(:updated_by => > > current_user)) > > format.html { redirect_to(@book, :notice => 'Book was > > successfully updated.') } > > format.xml { head :ok } > > else > > format.html { render :action => "edit" } > > format.xml { render :xml => @book.errors, :status > > => :unprocessable_entity } > > end > > end > > end > > > Which doesn't error HOWEVER it still isn't populating the right fields > > in the VERSIONS table. Any ideas anyone? > > > On Sep 11, 9:06 pm, nobosh <[email protected]> wrote: > > > That's good. Seems to confirm that you can record the updated_by on > > > updates. The user's issue in the link was he wants a version for the > > > 1st record created which isn't something I'm worried about since > > > that's in the books table. So some how that user by the updated_by to > > > work and populate the user_id column in the version table. > > > > On Sep 11, 9:00 pm, radhames brito <[email protected]> wrote: > > > > >http://github.com/laserlemon/vestal_versions/issues#issue/25 > > > > > On Sat, Sep 11, 2010 at 11:54 PM, radhames brito <[email protected]> > > wrote: > > > > > oh , ok, i think you can also edit the versions table by altering the > > > > > migration that way you can create an association, but im not done > > watching > > > > > the railscast > > > > > > On Sat, Sep 11, 2010 at 11:52 PM, nobosh <[email protected]> > > wrote: > > > > > >> Thanks radhames but I'm not trying to implement auditing. > > > > > >> I'm trying to create a wiki like system for books so I have > > > > >> versioning, which is what vestal_version does. The 'acts_as_audited' > > > > >> is more about creating an audit trail of all activity and isn't > > about > > > > >> seeing past versions, reverting etc... > > > > > >> I did find this one post that talks about what I'm trying to get > > > > >> working: > > > > >>http://github.com/laserlemon/vestal_versions/issues/unreads#issue/7 > > > > > >> The thinking is now: > > > > > >> def update > > > > >> �[email protected]_attributes(params[:book].merge(:updated_by => > > > > >> current_user)) > > > > >> end > > > > > >> It isn't working yet but I think we're close :)! > > > > > >> On Sep 11, 8:48 pm, radhames brito <[email protected]> wrote: > > > > >> > there is another gem that can help you since it save the user that > > made > > > > >> the > > > > >> > change automaticly is called > > > > > >> > acts_as_audited > > > > > >> > i think it does exactly what you want. > > > > > >> >http://github.com/collectiveidea/acts_as_audited > > > > > >> > On Sat, Sep 11, 2010 at 11:34 PM, radhames brito < > > [email protected]> > > > > >> wrote: > > > > >> > > let me see the railscast to remember how to use it > > > > > >> > > On Sat, Sep 11, 2010 at 11:34 PM, radhames brito < > > [email protected] > > > > >> >wrote: > > > > > >> > >> @note.version is a number, is the version number, you are > > pulling the > > > > >> > >> wrong property > > > > > >> > >> On Sat, Sep 11, 2010 at 11:31 PM, nobosh <[email protected]> > > > > >> wrote: > > > > > >> > >>> If I update the code to: > > > > > >> > >>> @current_userid = current_user.id > > > > >> > >>> @note.version.user_id = @current_userid > > > > > >> > >>> Rails3 seems like that better, the error is now: > > > > >> > >>> undefined method `user_id=' for 1:Fixnum > > > > > >> > >>> On Sep 11, 8:25 pm, nobosh <[email protected]> wrote: > > > > >> > >>> > Rails error'd on that.... > > > > > >> > >>> > Error "Called id for nil, which would mistakenly be 4 -- if > > you > > > > >> really > > > > >> > >>> > wanted the id of nil, use object_id" > > > > > >> > >>> > On Sep 11, 8:20 pm, radhames brito <[email protected]> > > wrote: > > > > > >> > >>> > > this does not work? > > > > >> > >>> > > @book.version.user_id = @current_user.id ? > > > > > >> > >>> > > On Sat, Sep 11, 2010 at 8:23 PM, nobosh < > > [email protected]> > > > > >> wrote: > > > > >> > >>> > > > Anyone using vestal_versions: > > > > >> > >>> > > >http://github.com/adamcooper/vestal_versions/ > > > > > >> > >>> > > > How do you set the user_id in the versions table? > > > > > >> > >>> > > > tried: > > > > > >> > >>> > > > in: > > > > > >> > >>> > > > def update > > > > >> > >>> > > > �[email protected]_id(@current_user.id) > > > > >> > >>> > > > and > > > > >> > >>> > > > @book.user_id(@current_user.id) > > > > > >> > >>> > > > both error > > > > > >> > >>> > > > thanks > > > > > >> > >>> > > > -- > > > > >> > >>> > > > 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]<rubyonrails-talk%2Bunsubscrib > > > > >> > >>> > > > [email protected]><rubyonrails-talk%2Bunsubscrib > > [email protected]><rubyonrails-talk%2Bunsubscrib > > > > >> [email protected]><rubyonrails-talk%2Bunsubscrib > > > > >> > >>> [email protected]> > > > > >> > >>> > > > . > > > > >> > >>> > > > For more options, visit this group at > > > > >> > >>> > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > >> > >>> -- > > > > >> > >>> 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]<rubyonrails-talk%2Bunsubscrib > > > > >> > >>> [email protected]><rubyonrails-talk%2Bunsubscrib > > [email protected]><rubyonrails-talk%2Bunsubscrib > > > > >> [email protected]> > > > > >> > >>> . > > > > >> > >>> For more options, visit this group at > > > > >> > >>>http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > >> -- > > > > >> 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]<rubyonrails-talk%2Bunsubscrib > > > > >> [email protected]><rubyonrails-talk%2Bunsubscrib > > [email protected]> > > > > >> . > > > > >> For more options, visit this group at > > > > >>http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > 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]<rubyonrails-talk%2Bunsubscrib > > [email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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.

