Displaying 20 results from an estimated 4000 matches similar to: "Making Validations Optional"
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi
I noticed that if in my code I use the following:
Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})")
All my objects are properly updated but none of the filters/callbacks
are triggered. Is that what''s expected?
I have a before_update filter set on the Photo class and it gets
totally ignored, I guess the only way to solve this
2007 Jul 25
5
set_default_values rocket science - continuing after_initialize/after_find misfeature
Just starting a new thread so that it''s easy to follow.
I just submitted a patch at trac to add a new class method called
"set_default_values" ( not a great name I think ), which lets you do
all kinds of crazy stuff with setting default values.
This ticket is at http://dev.rubyonrails.org/ticket/9093 and example
pastie is at http://pastie.caboo.se/81925
It also lets you make
2007 Aug 21
2
counter cache
Hi,
I have two models, employees and departments, and i am using
counter_cache to count the number of employees in a department.
This works great, but employees can change their departments, and the
counter cache does not get updated to reflect this.
Is their a built in way to do this, or do i have to implement my own
before_save hook
thanks
--~--~---------~--~----~------------~-------~--~----~
2007 Oct 18
9
with_scope issue
I have the following code:
class User < ActiveRecord::Base
has_many :requests do
def find_active(options = {})
with_scope :find => { :conditions => ["requests.active = ?",
true] } do
find(:all, options)
end
end
end
end
Executing user.requests.find_active results in the following SQL:
SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND
(
2007 Aug 23
3
test/mocks/ in rails directory structure
Anyone ever uses test/mocks/development && test/mocks/test directories ?
If someone does, test/mocks/development doesn''t really seem like a
nice place for putting development environment mocked classes. May be
mocks/ should be moved to RAILS_ROOT ? Or may be it should be removed.
Views ?
--
Cheers!
- Pratik
http://m.onkey.org
2007 Dec 11
2
Patch 10463: has_many through using uniq does not honor order
Hi,
I''ve just submitted a patch for ActiveRecord;
http://dev.rubyonrails.org/ticket/10463
The patch includes new fixtures because I could not find a applicable
combination among the existing fixtures. I hope that''s okee.
Please +1 or comment it.
Thanks,
Remco
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
2007 Aug 02
4
ActiveRecord Limitation (Advance)
Or is it ?
Need to be able to :-
@search =
Form.find(:all, :include=>[:form_type, :form_type_items], :conditions=>....)
I need in the Form model a :form_type_items, the question is, what is
the relationship type?
Current Models:-
Form
belongs_to :form_type
FormType
has_many :form_types
has_many :form_type_items
FormTypeItem
Belongs_to :form_type
Form
----------------
| id |
2007 Oct 24
5
Utility that checks outdated patches
I just noticed I frequently encounter patches that need to be updated
because of applied changes. Maybe this can be automated? Not
automating the "updating of the patch" part, but the part where a
comment is posted to the ticket so the submitter is informed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2008 Dec 23
3
rake doc:guides error
I have Rails 2.2.2 installed and get the following message when I try
to generate the rails guides:
Family-iMac:expences Dad$ rake doc:guides
(in /Users/Dad/Documents/Rails/Apps/expences)
rake aborted!
Don''t know how to build task ''doc:guides''
(See full trace by running task with --trace)
Family-iMac:expences Dad$ rake doc:guides --trace
(in
2009 Feb 17
8
Converting Acts_As_Tree to Acts_As_Nested_Set
Hello,
I have a tree structure that needs to be converted into a nested set.
A great deal of work has already been done on the tree items, so
maintaining the integrity of the id''s is mandatory. However I need
the ability to access entire branches of the tree, which is what
Nested set does. Does anyone have any suggestions on how to
efficiently transfer the tree to the nested set and
2007 Aug 09
4
no route found to match "/rails/info/properties" with {:method=>:get}
After a new install (Ruby, Rails en Gem) on a newly installed OS. I''m
getting a ''no route found to match'' error. I Googled a bit, and saw
that more people had this problem with older rails versions. I''m on
Ruby 1.8.6, Rails 1.2.3 and Gem is 0.9.4, on a Mac running OS 10.4.9.
Any suggestion is welcome.
Regards,
Robert.
2010 May 04
2
Session Store Issues on Production Server
Hello,
I am using AuthLogic as my authentication gem. Everything is great on
my development server. When I upload to my passenger driven
production server at Dreamhost, the sessions are persisting
relentlessly. In other words, a user cannot log out. I have tried
implementing the Active Record session store and have changed
the :secret key in initializers/session_store.rb, but for some reason,
2007 Dec 02
5
walkthrough: Rails 2.0 startup process
I haven’t found a complete big-picture walkthrough for the Rails
startup process when I looked for one recently.
There are some really useful resources about this but they are for
Rails 1.2 and each of them only covers certain parts of the process.
Thus, I’ve taken some notes while reading to the Rails code and
compiled the following guide from them.
2006 Jun 25
3
Dummy field in a model
I want to have a field in model, which I''m not storing in a database.
And I want to do something like the following in the model code :
validates_format_of :field_NOT_in_db, :with => session[:field]
How can I do it ?
Thanks,
Pratik
--
rm -rf / 2>/dev/null - http://null.in
2006 Jan 25
24
RailsCron 0.2 plugin
I received feedback from some of you, saying that it would be cool if
RailsCron was even easier to manage. So I implemented a graceful
start/restart inside of the plugin''s init.rb. If you don''t like it,
comment it out and send me the feedback.
Also, I finished an update to RailsCron that allows you to attach
asynchronous processing methods to your ActiveRecord models. i.e.:
2008 Jan 02
3
Submitted a patch, got pluses, what now?
Hello Rails people,
I submitted a patch recently to get rid of an annoying exception raised when
an AR
object is created - http://dev.rubyonrails.org/ticket/10556 , had some
people review it,
got some pluses... What am I supposed to do now?
Can anybody advise or just review the patch and take care of the issue?
Thanks!
--
Best regards,
Yuri Leikind
2007 Jul 18
16
Edge Rails namespaced routing
Hi,
I was wondering if anyone came across a similar scenario when working
with namespaced routes with edge rails.
Consider an application with controllers customers and products that
also have other resources.
map.resources :customers do |customer|
customer.resources :notes
customer.resources :tags
end
map.resources :products do |product|
customer.resources :notes
customer.resources
2006 Jan 20
4
validates_format_of > Invalid regular expression with simple pattern
Hello,
I try this :
validates_format_of :name , :with => /^[A-z0-9_.- ]*$/ , :message =>
"bad characters"
for accept any name with chars "A" to "z" , "0" to "9" , with "_" "."
"-" and " "
The pattern is really simple but I have this error :
SyntaxError in Login#register
2010 Aug 18
2
Windowed Postgres Query
Hello. I have a database query I am trying to develop.
For the purpose of explanation, I am going to use a suit of playing
cards in ascending order as an example. The complete data set would
look like this: [2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A]
The WHERE clause would contain "suit = hearts" and the ORDER would be
"value ASC". I need to be able to page through the
2007 Aug 07
3
XSendFile problem
I am trying to user XSendFile in my application.
I have installed the plugin and in the environment.rb included this line
XSendFile::Plugin.replace_send_file!
but it is unable to read the files.
Earlier i had used send_file but it increases the mongrel size and slows
down the application.
Any suggestions about how to make it work?
--
Posted via http://www.ruby-forum.com/.