similar to: ActiveRecord before_ callbacks question

Displaying 20 results from an estimated 700 matches similar to: "ActiveRecord before_ callbacks question"

2006 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out why I keep getting the ''wrong number of arguments (1 for 2)'' error with the following code when I try to create a new record. If anyone can see what is going wrong here please help! new.rhtml ------------------------------------------------- ... <%= start_form_tag :action =>
2009 Dec 24
4
NoMethodError
Hi, In a few words, can someone explain to me the NoMethodError. Googling for answers will get you to something but a direct answer from experts will give you something. NoMethodError in Book#new Showing app/views/book/new.html.erb where line #4 raised: undefined method `title'' for #<Book id: nil, created_at: nil, updated_at: nil> Extracted source (around line #4): 1:
2008 Sep 10
0
wrong number of arguments
I am a newbie at rails and can''t figure out the following problem. Can anyone help? I am running the following: Ruby version 1.8.6 (powerpc-darwin9.4.0) RubyGems version 1.2.0 Rails version 2.1.0 Active Record version 2.1.0 Action Pack version 2.1.0 Active Resource version 2.1.0 Action Mailer version 2.1.0 Active Support version 2.1.0 I created three models using the:
2006 Jun 02
3
Advice, why value_before_type_cast in FormHelper?
I am wondering why is in creating text fields with form_helper used value_before_type_cast instead of attribute value for field value? I set rails enviroment so date fields are in european format (dd.mm.yyyy) and would like to have same format in forms, but because of value_before_type_cast is called, form fields are filled with ''yyyy-mm-dd'' or timestamp integer, etc.
2006 Mar 01
3
Form helpers and overloaded methods - help!
Can someone explain why form helpers appear to bypass any model methods I override for fields that are bound to database fields? It would be great if someone could tell me how to force the form field, etc to call the method instead of looking at the database / attributes collection. Let''s say I have a column called ''price'' in my database table "books"
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in the browser. <h1>New member</h1> <%= error_messages_for :member %> <% form_for(:member, :url => members_path) do |f| %> <fieldset> <legend>Member Info</legend> <p><label for="member[first_name]">First Name:</label> <%=
2007 Jan 12
9
Nil object in E1 capture the order
I''m following the depot application in the rails bible Agile Web Development with Rails. In interation E1 NoMethodError in Admin#checkout Showing app/views/admin/checkout.rhtml where line #12 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.include? Extracted source (around line #12):
2006 Nov 04
2
how to use LabellingFormBuilder
Railsers: As usual for a product written very rapidly, most of its documentation assumes some other documentation told you something critical. For example, the file form_helper.rb tempts me with this documentation: # <% form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %> That''s beautiful. Now what do I
2004 Jul 16
3
Email eller vedhæftet fil blokeret
Email eller vedhæftet fil afsendt fra din adresse (eller med din adresse som afsender) er blevet afvist fra Allerød Kommune. Spam og virus bliver typisk sendt under dække af andre afsendere og den blokerede email behøver derfor ikke oprinde direkte fra dig. (Husk dog altid at have et opdateret antivirusprogram på din computer.) Du kan evt. scanne din computer med det gratis' værktøj
2008 Dec 20
3
undefined method `stories_path'
Hi, I recieve error "undefined method `stories_path'' for #<ActionView::Base:0x995b4ac>" when going to the view via site.com/stories/new The model is setup correctly, I can retrieve data from the db fine. I think it might be related to the helper but I have no idea where to start. It seems to think its failing on the first line of the view, i belive on the
2009 Nov 18
4
rails newbie : routing error
After much ado about the naming of model adn controllers... model : Expense controller : Expenses route : map.resources :expenses Here I am using mysql database and created a unique index, since db:migrated created an id object and made it as primary key. Now in the def create @expense = Expense.new(params[:expense]) if @expense.save flash[:viola] = ''New expense saved.. be
2004 Jul 29
2
XP does not join domain
hi, i've the following problem: i want a XP pro sp1 to join my samba (3.0.5) domain (MHC). with my first try it complained that it could not resolve: _ldap._tcp.dc._msdcs.MHC i've fixed this with the following DNS setup: ------------------------------ _ldap._tcp.MHC. 600 IN SRV 0 100 389 server.MHC.
2009 Mar 05
6
About before_* callbacks
Hi I have an problem about before_* callbacks. I have a model named: Event And I don''t want anyone to destroy or update any records in Event model. So: [code] class ActiveRecord::Base before_destroy :log_illegal_operations before_update :log_illegal_operations private def log_illegal_operations Event.create({:key => "illegal operation", :value =>
2003 Jun 30
0
Performance: FASTIO_CHECK_IF_POSSIBLE win32 call differs on Linux / SunOS [LONG]
Hello, I'am having huge performance problems using a application on win32 which uses alot of .DBF files. The app uses *alot* of small file reads, varying between 20-512 bytes per read. On Windows there is something, only just learned this, called fastio. This fastio acts like a cache because it reads-ahead 4096-bytes even if you want to have 1 single byte. Ok, that's all nice _but_
2010 May 20
7
unable to join to a Samba4 domain
I'm trying to join a Windows 2008 to a Samba4 domain. I'm able to ping Samba4 or browse its network shares. Unfortunately, I can't join Windows 2008 to this Samba4 domain - I'm not even asked for Administrator password. Windows 2008 errors with the below message, which roughly translates to: DSN-query for domain "samba4.my.domain" was successful. The query was for
1999 Feb 10
1
problems with read.table
Dear R users, I have the following problem: I have a table in ASCII-format, separated with commas. I can read it as long as no field contains a comma itself. If one does, read.table doesn't function even though that field is double-quoted. Ex.: File "test.csv": Name,Strasse,PLZ Jsaac,Gossauerstrassee 29,9100 Roth-Bernasconi,"20, ch. des Fauvettes",1212 adressen <-
2006 Aug 19
5
Form helpers don''t work with facade columns?
Hello all, I''ve been trying to use a facade column but I notice that the form helpers don''t seem to respect the facade. In the following example I''m trying to story the prices as Integer values but present them to the user as decimals. class Product < ActiveRecord::Base def price=(new_price) write_attribute(:price, Float(new_price)*100) end def price
2006 Apr 06
3
Formating Float ActiveRecord attributes in text inputs
I have AMOUNT field that ActiveRecord maps to Float. Then I use text_field helper to generate text inputs on forms. Helper takes model object and attribute name and does not provide any formatting abilities, thus 2.40 is shown as 2.4 which is fine with floats but does not look good with currency. I have worked around this issue by adding amount_f attribute to the model that returns formatted
2007 May 29
3
Use Windows USB drivers?
Hi, I'm using an application that works very well with Wine but that application requires a specific USB hardware where no (and no similar) Linux driver is available for. Therefore my question is: the application comes with a fully working Windows driver for that hardware, is it possible to use that driver to access the hardware via Wine? Until now I could not get it work but I'd expect
2008 Apr 09
3
form_tag and form_for cause #protect_from_forgery errors
Hey All, I''m trying to do a simple form_for (and I also get it with form_tag) and I''m getting the following error: ActionView::TemplateError (No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).) on line #2 of users/new.fbml.erb: 1: <h1>Welcome To Courses, Let''s Get