similar to: access to an ApplicationController property from a view

Displaying 20 results from an estimated 3000 matches similar to: "access to an ApplicationController property from a view"

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''
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 ||
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
2007 Feb 28
5
How to use find_options in multi_search
Hello everyone, I''m using multi-search to search in some attributes of two classes. One of the attributes is the id of the customer. For each multi_search I want to do a give the id of the current customer as a parameter. This should only return results for the given customer. My current code looks like this: Folder.multi_search(@search_query, [Myfile]) I noticed in the API you can
2008 Apr 18
3
Relating to records in same table
I''m in progress of making a little folder system with Ruby on Rails. I''ve got a "folders" table. Each "folder" has got an id and a folder_id. The folder_id is supposed to represent the folders'' parent folder. How can I tell Rails? I would like Rails to automaticly delete all subfolders of a folder when I delete the folder it self. Any ideas? --
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 15
6
error_messages_for trouble
I am trying so learn how to do custom validations. The validation works as expected, but I can''t get "error_messages_for" to display. How is the name of the object supposed to be formated? Where is this object created, the model or controller? What am I doing wrong here? #### Model ######################## class MyFolder < ActiveRecord::Base def validate # validation
2006 Aug 17
1
How to sort child table on fields in the associated parent
For an Xray file system patients have folders and folders have studies. That is: patients folders studies id id id name patient_id folder_id ... label type ... ... The list of studies with their associated folder and patient might look like this: name folder_label study_type
2004 Oct 04
1
Problem with incremental backup - copies instead of hard links
Hi there, I'm using this version of rsync: localhost:~ mzehetle$ /usr/local/bin/rsync --version rsync version 2.6.0 protocol version 27 Copyright (C) 1996-2004 by Andrew Tridgell and others HFS+ filesystem support for OSX (C)2004 Kevin A. Boyd <http://rsync.samba.org/> Basically incremental backup (--link-dest option) works with a destination on my local volume but not with a
2008 Dec 04
2
Cucumber and Rcov
I am now trying to get rcov to work for me, without much success. I stole the rake task code from the cucumber site: desc "Run all features" task :features => "features:all" task :features => ''db:test:prepare'' require ''cucumber/rake/task'' #I have to add this -mischa namespace :features do Cucumber::Rake::Task.new(:all) do |t|
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
2007 Aug 14
0
Temporary files / Uploads
Hi, how can I influence, where mongrel stores temporary files like uploads. As far as I can see, int honours the TMP or TEMP environment. Can I also set it in the configuration file for mongrel? I have not found something about it in the docs. Another thing: When I upload a file, the file is stored 3-4 times: In the TMP by mongrel as mongrel.3400.0 and then as CGI.3400.0 I currently
2006 Nov 01
1
Call a script after every file modification
Is there a simple possibility to hook in a script which is called every time a file is modified via smbd, e.g. a user is adding a file via samba share? The script should get also the filename too :-) The intended purpose is to duplicate the write operations of samba to another disk. Yes I know there exists RAID and Rsync and other software, but I want to use it for longtime archiving purposes,
2010 Aug 16
1
Split number of imap-login and pop3-login processes
Hi All, Is there a way to define the number for imap-login processes and pop3-login processes separately? My mail server is getting more IMAP clients and much less POP3 clients these days and it continues to run out of authentication processes. I have been increasing login_max_processes_count the last couple of days and I noticed that it's split between IMAP and POP3. All 129 imap-login
2007 Feb 06
2
Which method to use to get content from index with a_a_f?
Hi everybody, After staring at the a_a_f API for quite sometime now, I decided it''s time to ask... Which method should I use to get content from the index without using highlight? Consider the following controller action: def preview if params[:search].blank? # normal case @text = @myfile. # which method do I use here to get the :text from the index??? else # if we come from
2007 Jan 06
0
ApplicationController common view
I created a user login system in ApplicationController. There is a def called signin. It needs a view file, signin.rhtml I have a couple of other controllers inheriting from ApplicationController. Where can I place the view file so it is viewable across all controllers? I tried the root view folder but that didn''t work. Right now, I would have to copy and paste the signin.rhtml file
2006 Apr 24
12
Design Decisions
Hi All, I am doing some research on how people start with their Rails app. What design decisions are made and how is it build. For example: - do you use scaffolding and go from there? Or do you create everything from scratch? - are you using multiple controllers? Or do you put everything in one? - do you use migrate? - how do you use migrate? Do you call migrate your self or do you use the
2012 Jan 13
2
Using Dovecot-auth to return error code 450 (or other 4xx) to Postfix when user is on vacation
Hello to all members. I am using Dovecot for 5 years, but this is my first post here. I am aware of the various autoresponder scripts for vacation autoreplies (I am using Virtual Vacation 3.1 by Mischa Peters). I have an issue with auto-replies - it is vulnerable to spamming with forged email address. Forging can be prevented with several Postfix settings, which I did in the past - but was forced
2006 Jan 16
23
Read data from Excel
A client of mine has a ton of data stored in Excel spreadsheets. I''m building a web application for her (backed by a real db of course) and want to import all that data. Is there a library available to read data from Excel? Is there an easy way to upload the spreadsheets and then read the data? Thanks, Ken Kousen -- Kenneth A. Kousen, Ph.D. President Kousen IT, Inc.
2008 Feb 08
0
Challenge! How can I write a test to test the methods in ApplicationController?
Hi all, I''ve been Googling this one for a while now, and haven''t found a satisfactory answer. It has been posted here before by someone else, but it seems to have got forgotten, so here goes - perhaps someone can think up a way around the problem? In ApplicationController, I have the following method: class ApplicationController < ActionController::Base <snip>