search for: member_id

Displaying 20 results from an estimated 36 matches for "member_id".

2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id, rating, etc. What I have now is something like: if(@params[''category_id'']) @items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id'']) elsif(@params[''category_id''] and @params[''member_id'&...
2006 Jan 16
0
belongs_to with has_and_belongs_to_many
I''m having a problem with belongs_to and has_and_belongs_to_many. Here''s a brief summary of the models involved: class Member < ActiveRecord::Base set_primary_key ''member_id'' has_and_belongs_to_many :projects, :join_table => ''projects__members'' has_many :projects, :foreign_key => ''created_by'' end class Project < ActiveRecord::Base set_primary_key ''project_id'' belongs_to :created_by, :c...
2006 Feb 17
2
validate uniqueness of two fields
I have Proposals and Members and Members can vote for a proposal only once. So, I have "Vote belongs_to :member, :proposal", but to make sure a member only votes once, I want to make sure that there isn''t a vote in the db with that member_id and proposal_id. I can just put the appropriate find in a vote.valid? but I wanted to make sure I wasn''t missing a nice rails shortcut. In other words, can I do something with "validates_uniqueness_of" to make it consider a pair of columns, member_id and proposal_id? thanks,...
2006 Jun 15
2
AJAX form inside table - error
...nd spans few rows. This problem is only with AJAX forms, regular forms work perfect. I was wondering if this is something to do with prototype, or am I doing something completely wrong? Below, is a stripped down version of the code, which I have been trying. While calling the action the parameter, member_id is not passed. <table> <%= form_remote_tag(:url => {:controller => ''relationships'', :action => ''move''}) %> <%= hidden_field_tag ''member_id'',10 %> <tr> <td ></td> </tr> &l...
2006 Aug 09
1
help:sql search for NULL
...if the corresponding filed is NULL as well. I wrote down the following code but it doesn''t return anything. I wonder what I am doing wrong. Any help is greately appreciated. def self.match_for_assignment(assignment) self.find(:all, :conditions => [''matches.member_id IN (?, NULL) AND matches.study_id IN (?, NULL) AND matches.tag_id IN (?, NULL)'', assignment.member.id, assignment.study.id, assignment.tag.id]) end -- Posted via http://www.ruby-forum.com/.
2006 Jul 24
0
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
...DRb and File Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of course, but I still have a few questions. I made a simple upload form (as a test) that is submitted to the "upload_song" action. def upload_song @song = Song.new(params[:song]) @song.member_id = session[:member_id] @song.save redirect_to :action => ''edit_songs'' end The question is, do I create the session[:job_key] within this method like so: ?? def upload_song # I know my :args is probably wrong. What is the correct argument for args in this case?...
2007 Nov 05
0
Authentication: is a guest a user or an "exception"?
...<%= member_logged_in? ? member.nickname : ''Guest'' %>! <%= "You have #{member.private_messages.find_by_status(:unread)} unread PM''s" if member_logged_in? %> While the member function looks something like that: def member Member.find_by_id(session[:member_id]) end ---------------------------------------------------------- Alternative 2: the guest user exists in the database (with the nickname "Guest") like any other user and is automatically treated as logged in, as long as the visitor doesn''t explicitly login himself Hello <%=...
2006 Jan 29
9
Specify options with habtm
Hi all I have the following models: class member has_and_belongs_to_many :disc_jockeys end class disc_jockey has_and_belongs_to_many :members end The relation table is called disc_jockeys_members and has the following fields: disc_jockeys_members(disc_jockey_id, member_id, status) So far, the field status can have values like valid, invalid, locked etc., but it is not regarded yet by Rails. So I would like to integrate it with the standard methods. josh $ script/console >> m = Member.find(:first) >> m.disc_jockeys # Returns all associated disc jockey...
2005 Sep 23
1
Sortable list with Ajax and delete function - working example
Hi. I read most of the postings here but unfortunately I didin''t found a complete example which could be used. Of cource the ones who are professionals in javascript could implement the missing peaces from the puzzle. What I''m required to do is a tree (sortable list) where items can also be deleted and at each modification a function (ajax) is called to save the changes. For
2006 Jan 09
6
has_and_belongs_to_many :self
...owing class: class Member < ActiveRecord::Base has_and_belongs_to_many :buddies, :class_name => ''Member'', :join_table => ''members_have_buddies'', :foreign_key => ''member_id'', :association_foreign_key => ''buddy_id'' end You can see that a member can have any other member as a "buddy"; these relationships are held in the table members_have_buddies (member_id, buddy_id). So far, so good. I have a member...
2006 Feb 03
2
acts_as_tree counter_cache behavior is different than API docs
...create a database column called "children_count" to hold the counter_cache. I have enabled this option in my model. While writing tests I wrote a test for creating children from the a parent: message = @forum_message["parent"].find child = message.children.create( "member_id" => 1, "forum_id" => 1, "subject" => ''another subject'', "body" => "good grief.") This follows the the API docs pretty closely at http://ar.rubyonrails.com/classes/ActiveRecord/Acts/Tree/ClassMethods.html However, the test...
2006 Aug 03
4
Map a resource that is a join model
How should you map resources that are join models like Memberships? Lets say have you have Members and Groups that are joined through Memberships. map.resources :members do |members| members.resources :groups do |groups| groups.resources :memberships end end This doesn''t seem right. It would be nice to access all members, groups, and memberships at /members,
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I missed out on a lot of history. There''s probably some good explanation for something I''ve been wondering about, but I haven''t seen it written down anywhere. Maybe someone can clue me in. I''ve always felt that one of the uglier APIs was the ActiveRecord::find() method. I call
2006 Jul 24
4
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
...DRb and File Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of course, but I still have a few questions. I made a simple upload form (as a test) that is submitted to the "upload_song" action. def upload_song @song = Song.new(params[:song]) @song.member_id = session[:member_id] @song.save redirect_to :action => ''edit_songs'' end The question is, do I create the session[:job_key] within this method like so: ?? def upload_song session[:job_key] = MiddleMan.new_worker(:class => :upload_worker, :args => "...
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something like @member.items (Member with has_many :items)? Right now I do in the controller: @item_pages, @member_items = paginate :item, :conditions=>["member_id=?", @member.id], :per_page=>25, :order=>''datetime desc'' It''d be more DRY if this was possible: @item_pages, @member_items = paginate @member.items, :per_page=>25, :order=>''datetime desc'' And even more so if it could all be don...
2006 May 16
2
before_filter and the application controller
...on my filters look like this: class ApplicationController < ActionController::Base before_filter :check_authentication, :except => [:check_authentication] before_filter :register_member_activity, :except => [:check_authentication] def check_authentication unless session[:member_id] session[:intended_uri] = @request.request_uri redirect_to :controller => ''login'', :action => "signin_form" end end etc.............. Obviously, now all my controllers and methods have to pass through this authentication metho...
2006 May 12
2
Has many through join table issues
...o-fold. 1. When the visitor selects a top level category, I need to pull all members of all of the related subcategories. 2. When a subcategory is selected, I only need to pull the members who belong to that subcategory only. My Category table: id name parent_id my member_to_categories table: member_id category_id Any help will be greatly appreciated! -- Posted via http://www.ruby-forum.com/.
2006 Jun 08
3
has_many :through updates on delete.
I have a model that looks like this: class Actor < ActiveRecord::Base has_many :member_groups, :foreign_key => ''member_id'', :class_name => ''GroupMember'' has_many :groups, :through => :member_groups, :source => :group end class Group < Actor has_many :group_members, :foreign_key => ''group_id'',:dependent => :destroy has_many :members, :through =>...
2007 Oct 11
0
display problem with to_csv
...39;''' as ''User 2'','''' as ''User 3'', '''' as ''User 4'','''' as''Web Page'' FROM `edia_user_contacts`, edia_members m, edia_countries c WHERE m.id=''#{session[:member_id]}'' and user_member_id in (select partner_id from edia_member_partners where company_id = ''#{session[:member_id]}'') and c.id=`address_country`") respond_to do |wants| wants.csv do render :text => @report_data.to_csv response.headers[''Content-T...
2006 Jan 30
5
Functional tests and dealing with login before_filter
Hi all, I''m curious as to how you do functional testing on the controllers if, within the ApplicationController, I have a before_filter :authorize, :except => :login, where the private authorize method checks for session[:user]. I can''t do "post :login", because that method is in a different controller. I tried setting session[:user] directly in the setup