Displaying 20 results from an estimated 1000 matches similar to: "enforce mutual exclusivity"
2007 Nov 25
4
is notify resevered word?
Hi,
When I added this association...
class User < ActiveRecord::Base
has_one :notify
end
...and tried then to update column in User table it will call queries
for notify table automatic?
Output
---------------------------------------------------------------
User Columns (0.041488) SHOW FIELDS FROM `users`
User Load (0.001544) SELECT * FROM `users` WHERE (`users`.`nickname`
=
2007 Nov 01
3
autotest debugger?
Hi,
I keep facing problems with autotest, and I don''t know what''s happening
in the background, is there anyway to know what''s happening while
testing?
Example:
@user = User.new
@user.email = "testcom"
@user.errors.on(:email).should_not be_empty
...throws error failure
- You have a nil object when you didn''t expect it!
- You might have expected an
2007 May 06
2
render :action "call method first?"
Hi,
I know when I call:
render :controller => ''some'', :action => ''thing''
It doesn''t call the method ''thing'' before render the template
''thing.rhtml'', but I need some instance variable which are in the
''thing'' method, how can I let it call the method ''thing'' and then render
2010 Sep 09
17
formtastic issue
Hello,
I will try to explain it step by step :-)
I just created a new rails 3 app, then I created a new controller...
rails generate controller admin::users
I didn''t forget to add the resources in the routes.rb file like this.
namespace :admin do
resources :users
end
Now I try to use formtastic to create the form but I get erorr that my
users_path doesn''t exist?
2007 Mar 27
6
how does rails do this "find_by_?"
Hello there,
I''m wondering how do they create functions on the fly?
find_by_any_column_name ??
I want to do something similar with my models, but I don''t really know
how to do it?
user_current_nickname
user_current_id
user_current_role
etc.?
Regards,
Jamal
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this
2007 Oct 02
3
Note on Rails 2.0 Preview
Make sure you get a relatively current version of rspec or you will get:
/Users/me/rails/ubb/vendor/rails/activerecord/lib/../../activesupport/
lib/active_support/dependencies.rb:263:in `load_missing_constant'':
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
(NameError)
Hope this helps someone.
2007 Apr 12
4
Installing rspec in Windows
Hi all,
I''m trying to install rspec and I''m having a problem.
C:\Users\Nathan\Documents\rails\myproject> gem install rspec
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rspec-0.8.2
Installing ri documentation for rspec-0.8.2...
Installing RDoc documentation for rspec-0.8.2...
C:\Users\Nathan\Documents\rails\myproject> ruby
2007 Mar 29
4
validates_length_of not working with :if ?
Hello,
I''m trying to cut down the errors if the guy already getting the empty
nickname, so he doesn''t get anything about the nickname is short.
validates_presence_of :nickname
This below is not working ?
validates_length_of :nickname, :within => 4..40, :if => Proc.new {
|user| user.nickname.length > 1 }
nor this one below?
validates_length_of :nickname, :within
2007 Mar 01
1
RoR: Torrent Tracker
Hello their,
I managed to find torrent tracker made in RoR language, now I downloaded
and trying to run it, but I get error saying:
Could not find RubyGem bencode (>= 0.0.0)
I don''t know where i can get the bencode, anyone can help please :)
require_gem ''bencode''
regards,
Jamal
--
Posted via http://www.ruby-forum.com/.
2007 Sep 05
8
Hi..Guys new plugin again
Hi..
Guys new plugin again
Foreign Key Associations is a plugin that automatically creates
associations based on foreign-keys. The associations are created at
runtime-ie. as your ActiveRecord models are loaded-so they will always
be up-to-date.
For example, given a foreign-key from a customer_id column in an
orders table to an id column in a customers table, the plugin
creates:
2007 Oct 29
2
rspec throws exception (nameError)
Hi,
I''m running Rails 1.2.5 with rspec 1.0.8.
When i runned autotest first time, it complained about this line.
#include ActionView::Helpers::JavaScriptMacrosHelper
in vendor/plugins/rspec_on_rails/lib/spec/rails/dls/behaviour/helper.rb
...I commented it out, then I got another error about this line, so I
also commented this out.
#Test::Unit.run = true
in
2008 Aug 25
2
Validating an association
I have two models, A and B, related to one another by a many to many
association and I want to validate an object of model B as it''s being
added to the association based on both its own attributes and
attributes of the particular object of model A that it''s being
associated with.
I''ve realized that I can''t do this if the association is represented
by a habtm
2008 Nov 11
1
Admin controller
This is very weird behavior for rails.
1. When I visit my app
http://localhost:3000/admin/base/login
class Admin::BaseController < ApplicationController
def login
render :text => "running"
end
end
2. but when I go here
http://localhost:3000/
I get error because login.html.erb not found
3. even though my route looks like this.
map.root :controller =>
2007 Aug 21
2
validates_acceptance_of (and hidden input)
Hi
Why does a failed "validates_acceptance_of" create a hidden input in
the view?
cheers, jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this
2007 Oct 08
2
flash messages?
Hello,
I''m using flash[:hash] in my application, and I feel like I''m forced to
make a redirect just to be sure that flash[:hash] doesn''t appear in any
other views?
flash[:notice] = "ASDDD"
redirect_to :action => :another_method_name
else
flash[:error] = "DSADS"
redirect_to :action => :same_method_name
How do you solve this problem, to be
2007 Apr 29
2
Validate unique within date range?
I''m setting up a simple system for listing products and specials. I''m
looking for a way to validate that only one special can exist per
product per date range. For example, if a product is on sale from
2007-04-29 to 2007-05-10, you cannot create a special for that product
that starts on 2007-05-09.
What''s the best way to do this with Rails? I''m fairly new to
2007 Oct 13
5
default date for date_select
Hi,
How can I set a default date for a date_select?
I''m trying to do something along the lines of:
<%= date_select("requirement", "target_date", :end_year =>
2020, :discard_day => true, :include_blank => true, :order =>
[:month, :year], :default => {:month => 10, :year => 2012 }) %>
but the default that comes up on the form is blank month
2007 Apr 06
4
using Ruby as a front end for a trading system
Hi All,
needed some direction for a newbie to RoR. I have done work in Java,
.net and perl, and really prefer perl and java over .net, now we are we
are looking to start building a financial trading application, most of
the team wants to go with .net while I am trying to build the case with
Ruby. Some of our classes have been developed in delphi7. Would I be
able to use RoR on the front end of
2010 Jul 12
1
How to turn :before_add exceptions into validation errors
As per http://rails.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
Possible callbacks are: before_add, after_add, before_remove and
after_remove.
Should any of the before_add callbacks throw an exception, the
object does not get added to the collection. Same with the
before_remove callbacks; if an exception is thrown the object doesnât
get removed.
However, when the add
2006 Apr 05
4
validation on before_add callback
problem: validation error is not functionning in callback
callback for many-to-many association:
# keyword.rb
:before_add => :reject_self_related
def reject_self_related(related_keyword)
if (related_keyword == self)
# this does not work:
errors.add(:name, "Relating a keyword to itself is
forbidden!")
raise "Relating a keyword to itself is