Displaying 20 results from an estimated 200 matches similar to: "Just update 1 field"
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,
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
2010 Mar 29
1
Realtime Issue
It seems that my realtime is not assigning channel variables correctly.
INFO
Asterisk 1.6.0.26
Exten.conf
exten => _X.,1,NoOp()
exten => _X.,2,Set(DEVICE=${CUT(CHANNEL,,1)})
exten => _X.,3,Set(NULL="${REALTIME(agents,device,${DEVICE})}")
exten => _X.,4,NoOp(DEVICE is ${DEVICE})
exten => _X.,5,NoOp(USERNAME is ${USERNAME})
exten => _X.,6,NoOp(username is
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 Jan 09
3
Selecting a subset of a table with DRY
Hello,
I have table called ''listings.'' There are a certain combination of
properties which make a listing viewable (e.g., it is confirmed, has
been authorized, hasn''t expired, etc.). Each listing has one and only
one category.
I want to be able to do things like Listing.find_viewable(...) and
Category.find(...).viewable_listings, but I see no way to do this
2006 Jan 12
12
Ajax Button Back function?
Hi Folks! I''m new in the forum and i have a doubt. The button back
function with the Ajax on Rails? tks.
--
Posted via http://www.ruby-forum.com/.
2006 Jan 10
7
Application Design Question
I am designing an application to run a fishing tournament I am
hosting. Each fish entered will be given a point total based on the
length of the fish and the species of fish. Each species has a point
multiplier. For Example Trout have a multiplier of 10 so a 20 inch
Trout would have a score of 200.
My conundrum is in where and when do I calculate the points. The
options I have come up
2006 Jan 12
7
user-defined columns
I am breaking ground on a new project and one of the issues I expect to encouter
is the ability of users to define their own columns. For example, one of the
features of this application will be the ability to store information about
people''s skills and then search for and schedule them based on this information.
Since every organization''s needs are different, it would be ideal
2006 Jan 12
4
If statement based on a action
Question for you all is it possible to use an action in an if
statement? I am using the same form for edit and new and I have a
cancel button on the page.
This cancel button is built with an if statement that looks right now
to see if a parameter exists to define where to go back to if the
user cancel. The problem occurs when the user submits the form and
there are missing fields by
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
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
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
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.
2006 Jan 09
5
mysql is not recognized as an internal or external command
Hi,
An absolute newbie to RoR, I''m currently going through a few of the
excellent tutorials that are available on the subject.
One of these includes running a script for creating a mySQL table. In
the command prompt (XP), I try
mysql depot_development <db/create.sql
but get the following error:
''mysql'' is not recognized as an internal or external command,
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
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 Nov 23
8
Compiler OR Obfuscator for RoR applications?
Hi folks,
I''m a newbie in the Ruby land, The Ruby language and RoR looks really
great but I think in my situation there is a problem, we are an ISV
that sells web application and we don''t want our clients see our
source code, I searched the web but couldn''t find any way to compile
and\or obfuscate ruby code (in web (RoR)), is there such tool
available for the language?
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
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