search for: updated_by

Displaying 20 results from an estimated 35 matches for "updated_by".

2006 Feb 26
3
Rails Naming Conventions
DB field names: If I have a table that references 2 or more separate users from my users table, is there a recommended naming convention for this situation? In my case, I have 3 users associated with a record in my projects table: requester_user_id created_by updated_by I could name one of them "user_id", and then projects.user would work I guess, but wouldn''t work for the others. Is there a recommendation for this kind of situation? Plurality in Classes: Not in class names as much as in the part where you say belongs_to, has_many, etc. S...
2006 Jan 20
11
Userstamp Plugin
...m http://www.delynnberry.com A dump of the Readme file is contained below -- Userstamp Plugin (v 1.0) ======================== Overview -------- The Userstamp Plugin extends ActiveRecord::Base( http://api.rubyonrails.com/classes/ActiveRecord/Base.html) to add automatic updating of created_by and updated_by attributes of your models in much the same way that the ActiveRecord::Timestamp( http://api.rubyonrails.com/classes/ActiveRecord/Timestamp.html) module updates created_(at/on) and updated_(at/on) attributes. The module requires that your application''s user object (User by default) contain...
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
...me"=>"Maastricht Wildcats", "updated_at"=>"2007-08-03 21:50:44", "deleted_at"=>nil, "created_by"=>nil, "organization_code"=>"KNVB347", "url"=>nil, "type"=>"SportClub", "updated_by"=>nil, "id"=>"7", "description"=>"", "deleted_by"=>nil, "created_at"=>nil}> >> sc.destroy => #<SportClub:0xb769c1a4 @sportables_sports=[], @deleted_by=nil, @contact_address=, @new_record_before_save=nil,...
2005 Aug 09
3
Adding created_by and updated_by trouble
Hi everyone. This is a real noob question that I''m hoping someone out there can help me with. I have followed the tutorial How to Ad created_by and updated_b<http://wiki.rubyonrails.com/rails/show/Howto%20Add%20created_by%20and%20updated_by>y and it works ok for retrieving the data. I''m using the Login_Generator. I cannot get it to work on create or update. I think it''s because I can''t get a class method to supply me with the required current_user method. I just get a nil object returned. I tried to u...
2011 Nov 18
1
What does :count actually mean in assert_select?
...ec2. Example: spec/factories/categories.rb ====================== FactoryGirl.define do factory :category_intakes, :class => ''category'' do name ''intakes and filters'' description ''airfilters and etc.'' created_by 1 updated_by 1 end factory :category_audio, :class => ''category'' do name ''audio'' description ''in car entertainment'' created_by 1 updated_by 1 end end spec/views/categories/index.html.erb ============================= req...
2006 Apr 10
1
random | in join statement with more than one :include
...t_amount_cfy` AS t0_r20, grants.`title` AS t0_r21, grants.`abstract` AS t0_r22, grants.`created_at` AS t0_r23, grants.`created_on` AS t0_r24, grants.`updated_at` AS t0_r25, grants.`updated_on` AS t0_r26, grants. `lock_version` AS t0_r27, grants.`created_by` AS t0_r28, grants.`updated_by` AS t0_r29, sponsor_agencies.`id` AS t1_r0, sponsor_agencies.`name` AS t1_r1, sponso r_agencies.`address` AS t1_r2, sponsor_agencies.`phone` AS t1_r3, sponsor_agenci es.`contact_name` AS t1_r4, sponsor_agencies.`created_at` AS t1_r5, sponsor_agen cies.`created_on` AS t1_r6,...
2006 Feb 14
10
acts_as_versioned and getting authors
Hey guys and gals, I have the following object that has acts_as_versioned: class Note < ActiveRecord::Base acts_as_versioned belongs_to :user end The schema for my notes table is as follows: create_table :notes, :force => true do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :user_id, :integer t.column :title, :string
2006 Dec 06
2
validates_uniqueness_of where scope euqals created_by "magic" field
...ActiveRecord::Base validates_uniqueness_of :created_by, :scope => :recipe_id belongs_to :recipe, :counter_cache => true . . . end The created_by field on Rating is implemented as a "magic" field similar to this: http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by. It is working fine. The validates_uniqueness_of :created_by, :scope => :recipe_id isn''t working. I can easily go about adding multiple Ratings per Recipe for a user. Maybe I''m missing something here, but what I want is to make sure that a user can only add one Rating per Reci...
2006 Sep 09
13
best way to add "created_by" entries to all tables???
Hi, I want to automate somewhat the addition of created_by/updated_by fields on my models (i.e. to include username). What''s the best/recommended way to do this? Would it be to: a) Find out how to extend the ActiveRecord::Base itself (I haven''t extended a class before yet) b) Use a plugin type approach where you have to add a tag manually to...
2006 Feb 10
0
Update two models that have belongs_to relationship
...gram]) @program.id = @program_old.id @point_of_contact = PointOfContact.new(params[:point_of_contact]) @point_of_contact_old = PointOfContact.find(@program_old.point_of_contact_id) @point_of_contact.id = @point_of_contact_old.id current_user = session[:user].login @program.updated_by = current_user @point_of_contact.updated_by = current_user @program.pointOfContact = @point_of_contact @program.save! This does not work and gives the error: Violation of PRIMARY KEY constraint ''PK__point_of_contact__1F2E9E6D''. Cannot insert duplicate key in object...
2006 Sep 26
0
Find Returning String Instead of Integer?
...272d6ec @attributes={"vendor_id"=>"1", "updated_at"=>"2006-09-26 12:00:38", "catalog_id"=>"8050", "price"=>"185", "created_by"=>"Unit Tests", "unit"=>"ea", "updated_by"=>nil, "id"=>"1", "description"=>"CAP analog for SP6 MegaScript kit", "created_at"=>nil}>] >> @cart.save => true >> @cart.items.find(1).quantity => "1" >> @cart.items.find(1).increment!(:quantity...
2006 Jul 18
1
usermonitor / user stamping active record
Quick question about userstamping records in a similar way to timestamping. There is an example of how this might work at: http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by/versions/7 This seems to work fine on my development system. However, I am not sure how the User.current_user method, which is required, can guarantee to return the correct user since this is a static accessor/method. If I set the class-level current_user as part of my request processing, the...
2006 Dec 11
1
Index help on Polymorphic Associations
Hello, I''m a newbie to aaf and rails and I hope anyone can help me with this. I have the following Models: class Project < ActiveRecord::Base acts_as_authorizable acts_as_audited :except => [:created_by, :updated_by ], :user_class_name => ''AuthenticatedSystem'', :user_method => ''current_user'' acts_as_ferret :fields => {:name => {:store => :yes}, :description => {:store => :yes}, :project_notes =&...
2006 Mar 26
5
How to write manage created_on and created_by via mixin?
...ing for since what I''m doing has to be relatively common. So, I''ve created a mixin called UserTimestamp.rb: module UserTimestamp def mark_created self.created_on = Time.new self.created_by = @user.user_id end def mark_updated self.updated_on = Time.new self.updated_by = @user.user_id end end And, then I include it and setup the before_create and after_create macros: require ''lib/UserTimestamp.rb'' class Video < ActiveRecord::Base include UserTimestamp before_create :mark_created before_update :mark_updated # ... etc... end Of cou...
2008 May 06
10
Best way to implement?
So I''m new to all this Rails stuff and this is probably a database design-related question to, but here it is... Just for learning I''m trying to build a little real estate listings application. Of course there is the listings model which will store basic information like name, price, description, and all that jazz. I''m to the point where I want to figure out how to
2006 Aug 12
0
insert into database failing
...) else redirect_to :action => ''details'' end end it fails with the following (note the values to be inserted are actually objects that have not been dereferenced: INSERT INTO line_items (`order_id`, `quote_id`, `updated_at`, `created_by`, `product_id`, `quantity`, `type`, `updated_by`, `unit_price`, `created_at`) VALUES(#<Quote:0xa75703d0>, #<Quote:0xa75738a0>, #<Quote:0xa75749a8>, #<Quote:0xa756b268>, #<Quote:0xa7561218>, #<Quote:0xa75632fc>, #<Quote:0xa7567b18>, #<Quote:0xa755ef40>, #<Quote:0xa7559fcc>, #<Quote:0xa75536...
2006 May 24
1
Automagic number of views/clicks?
Hey, Just wondering.. Are there are any automagic constructs in rails for keeping track of number of views/clicks associated with the record? For example, created_at and updated_at are automagically updated on edit/new actions, are there any similar constructs for clicks/views of the record? Thanks. Ilya -- Posted via http://www.ruby-forum.com/.
2006 Apr 12
0
class attributes and thread safety
Are class attributes thread safe? For instance, the userstamp plugin creates a User.current_user attribute and then it aliases the ActiveRecard create and update methods to write created_by and updated_by attributes using the value of User.current_user. For some reason I can imagine a case where multiple users are logged in at the same time and saving objects, and the value of User.current_user would be indeterminate. It could be that I''m applying too much "Javathink" because...
2006 Apr 18
1
''wrong number of arguments'' for text_field?
...<Inventory:0xb793a0e0 @new_record=true, @attributes={"created_on"=>nil, "status"=>0, "part_id"=>0, "account_id"=>0, "branch_id"=>0, "updated_on"=>nil, "created_by"=>nil, "quantity"=>1, "updated_by"=>nil}> Rendering within layouts/application Rendering inventories/new ActionView::TemplateError (wrong number of arguments (1 for 2)) on line #1 of app/views/inventories/_form.rhtml: 1: <%= text_field ''inventory'', ''quantity'' %> /usr/lib...
2006 Apr 19
0
How to rubify this query
...nce_of :name, :sequence, :accesslevel, :defaultpage, :handle belongs_to :cmodule belongs_to :creator, :class_name => ''User'', :foreign_key => ''created_by'' belongs_to :updater, :class_name => ''User'', :foreign_key => ''updated_by'' end Now this is my query: @menu = Menu.find_by_sql "SELECT self.* FROM menus self, menus remote WHERE self.parent_id = remote.id AND remote.handle = ''#{parent}'' AND self.accesslevel...