search for: spmm_pls

Displaying 7 results from an estimated 7 matches for "spmm_pls".

2006 Mar 13
6
:dependent => :destroy
Hi, There is something I don''t understand about :dependent => :destroy. I hope someone can help me. Consider this code: class Folder < ActiveRecord::Base has_many :myfiles has_many :folders has_many :group_folders, :dependent => :destroy validates_uniqueness_of :name, :scope => "folder_id" validates_presence_of :name before_destroy
2006 Feb 23
13
Check if a saved user''s name is admin
Hi all, I have a question about this method in my User model: # Returns true for the (saved) user called "admin" def is_the_administrator true if save and name == "admin" end The method returns true if the user''s name is admin. However, I only want to return true if the state of the object is "saved", so I call the save method first. I''m
2006 Feb 14
1
How can I order_by a sub folder?
Hi there! I have a folder model which can contain sub-folders. I want to save the sub-folders in a variable ordered by the name of the subfolders: folder = Folder.find(1) sub_folders = folder.folders # ... how can I order the sub folders by name here??? Thanks, Mischa.
2006 Jan 11
3
Just update 1 field
Hi All, I wonder how I can get rails to update just one field when I do Myfile.save. Right now this happens when I do a Myfile.save: UPDATE myfiles SET `folder_id` = 0, `filesize` = 1, `data` = ''2f7573722f6c6f63616c2f6d ... f7061636b65743d33324d'', `user_id` = 0, `date_modified` = ''2006-01-11T23:33:57+0100'', `filename` = ''mysqlscripts.sql''
2006 May 18
3
access to an ApplicationController property from a view
Hi there, How is it possible to get access to an ApplicationController property from a view? Consider this (simplified) situation: class ApplicationController < ActionController::Base def folder_id @folder_id = params[:id] return @folder_id end end class FolderController < ApplicationController def show @folder = Folder.find_by_id(folder_id) end end So far,
2006 Jan 16
4
Question about self and private
Hi! There''s something I don''t understand yet about static/private methods. I hope someone can explain... E.g.: class SayHello def hello(who) puts "Hello, " + who + "!" end def self.say(words) puts words end end hello = SayHello.new hello.hello "World" : Hello World! hello.say "hi" : Error SayHello.say
2005 Oct 23
12
Showing a neat error message
Hi All, I''m trying to prevent users from deleting a folder that has contents like this: class Folder < ActiveRecord::Base has_many :myfiles has_many :folders belongs_to :folder validates_uniqueness_of :name, :scope => "folder_id" before_destroy :dont_destroy_folder_with_contents def dont_destroy_folder_with_contents if Folder.find(id) != nil ||