similar to: Controllers, Models, and Validations...

Displaying 20 results from an estimated 8000 matches similar to: "Controllers, Models, and Validations..."

2007 Jul 21
2
avoiding timconsuming for loop renaming identifiers
Hi All I was wondering if I can avoid a time-consuming for loop on my 600000 obs dataset. school_id y 8 9.87 8 8.89 8 7.89 8 8.88 20 6.78 20 9.99 20 8.79 31 10.1 31 11 There are, say, 143 different schools in this 600000 obs dataset. I need to thave sequential identifiers, 1,2,3,4,5,...,143. I was using an
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations, what is the ''best'' way to handle validations? As an example: class Student < ActiveRecord::Base # some attrbutes like # :name # :grade # relationships has_many :students_assignment, :dependent => :destroy has_many :assignments, :through => :students_assignment has_many
2006 Jul 09
0
RailsConf Europe, Sept. 14-15: don''t put it off!
Hi everyone -- In the excitement of the Chicago RailsConf and other recent events, don''t forget the excitement of RailsConf Europe! You''ve heard of it, but it seems kind of shadowy compared to the "big" events? Here''s the news: >>>>>>>>>>>>>>>> It IS a big event!
2006 Jun 28
0
ActiveResource (was: 1.1.3 available.)
2006/6/28, Paul Barry <mail@paulbarry.com>: > Where can I find info about the "CRUD/resource-based features" that will be > in 1.2.0? In blogs. Especially about Railsconf and DHH''s keynotes. In trunk : http://dev.rubyonrails.org/browser/trunk/activeresource In DHH slides : Transcription of some slides from DHH''s talk at RubyKaigi 2006 (I suppose it must
2009 Feb 12
4
routes
I''m trying to figure this. in my schools controller i want to do this.... # implement a create action to create just the review for the School... def create_review_for_a_school @review = Review.new @school = School.find(params[:school_id]) @review = @school.reviews.build(params[:review]) if @review.save # The creation worked....do this flash[:notice] =
2006 Nov 04
0
Free Rails workshop in Malmo, Sweden, Sept. 17
Hi -- I''m going to be giving a free (but limited enrollment) one-day Rails workshop in Malmo, Sweden, on September 17. The event is presented by Polar Rose (http://www.polarrose.com). For more info: http://www.polarrose.com/about/ruby-on-rails-workshop-by-david-black Hop on over from London if you''re at RailsConf Europe! (Which [London] is where I am now.) David --
2006 Jul 31
2
Updating a belongs_to foreign key leaves the old association object available
Perhaps this is intentional, but it seems unlikely: class Person < ActiveRecord::Base belongs_to :school end p = Person.find(:first) p.school # nil p.school_id = School.find_by_name(''High School'').id p.school.name # High School p.school_id = School.find_by_name(''Primary School'').id p.school.name # High School <= Shouldn''t this be Primary
2005 Dec 05
1
data frames, na.omit, and sums
Dear R-helpers, New to R, I'm in the middle of a project that I'm using to force me learn R. I'm running into some behavior that I don't understand, and I need some advice. In the last week I've gotten some great advice from the list on visualizing my data, and I was hoping people could help me get over another barrier I've encountered to my progress. Before I
2008 May 25
2
record will absolutely not save! so weird, please help.
I have a weird problem going on. All of sudden, records for a certain model will not save with #save Please take a look at this: >> p = Payment.new(:payment_reason_id => 1, :payment_method_id => 1, :date => Date.today, :amount => ''5.00'', :payable => Student.find(608)) => #<Payment id: nil, school_id: nil, payment_reason_id: 1, payment_method_id: 1,
2006 Nov 04
0
How do CRUD and REST work for a wizard-style application?
I''m rewriting an application with the intention to use the elegant CRUD and REST design principles as outlined by DHH in his RailsConf Keynote[1]. The question is: how do you use those principles for an application that is of a sequential nature? The application works much like an MS Windows wizard: user begins at screen foo. After doing (or not) some stuff in screen foo, he is taken to
2009 Feb 09
3
rendering original view
def create # next statement is original and is removed # @review = Review.new(params[:review]) @school = School.find(params[:school_id]) # @review = @school.reviews.create!(params[:review]) @review = @school.reviews.build(params[:review]) respond_to do |format| if @review.save flash[:notice] = ''Review was successfully created.'' #
2011 Mar 01
0
Association data within a fields_for
How do I use association data from within a fields_for? I''ve got a has many through relationship between users, schools and schools_users. A user can have multiple schools and a school has multiple users. In schools_users there is a user_role field in addition to the common user_id and school_id. In the show view I have: <% @school.schools_users.each do |user| %>
2010 Mar 10
1
trouble calculating rates--sometimes the denominator is missing
Every day I get a csv file containing the names of the 64 schools in our county, the number of students sent home ill, and the number of students absent (plus lots of other variables). The file is cumulative since fall of 2009. It is in "long" format: one line per school per day. Each line is also supposed to contain the total number of students enrolled in the school. That number
2006 Jun 22
4
Authorization Plugin 1.0 release candidate + 3 test apps
In honor of RailsConf, I''m releasing an authorization plugin with 3 test apps that show you how to use the system. A reasonably lengthy description can be found here: http://www.writertopia.com/developers/authorization I will also be talking about the plugin''s architecture in my RailsConf talk on Saturday. Some features: - Nice English-like way of expressing permissions through
2006 Feb 11
2
Migrations and Unintialized Constants Error
I am running into a problem with two of my tables and the "uninitialized constant" error when using migration. I get the "uninitialized constant Note" when running the following code in my migration file: create_table :notes do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :title, :string t.column :covered, :string
2006 Jun 27
4
Use link_to in a controller?
Hello. I realize that link_to is a helper that generally only has use in a view file, but recently I have come across a situation where it would be useful in a controller. I am trying to create a flash[:notice] and I want to link to another page. Of course, I could hard code the HTML, but for the sake of consistency, I was wondering if there is a way to abstract it from within the controller
2013 May 03
0
Moving plural detection and --force-plural option to models generator
Hi all, I talked to Aaron briefly about this at RailsConf, but I just wanted to bring this up here before I start working on it in case anyone objects. I will be looking into moving the "Plural version of the model detected, using singularized version. Override with --force-plural." warning and the associated flag into the model generators. Currently this is only in the resource (and
2006 Jun 25
0
Using the database schema to help validate data
I started working on this in response to Dave Thomas'' keynote as RailsConf 2006. This little patch will validate that your text fields will fit into the database. Obviously this is just a start, and many more validations could be added. Also, this code could probably be extracted into a plugin instead of patch to ActiveRecord. Index: test/validations_test.rb
2006 Jun 13
0
[ANN/ADV] Rails Recipes is Shipping
Hi All, Pragmatic Dave Thomas tells me that Rails Recipes (http://pragmaticprogrammer.com/titles/fr_rr) is now shipping! He and Andy apparently have over a ton of books to deliver. If you''ve ordered a paper book, it''s soon on the way. If you''ve been waiting, now''s the time. Amazon is also has the book in stock
2009 Jun 04
0
Trying to get a job at Engine Yard
This is sort of Rails-related :) I recently applied for a job at Engine Yard after meeting the staff at RailsConf 2009. EY as you probably know is one of the premiere hosting companies for Rails. The told me to "send them something that would get me hired". After slaving over my resume and putting extra effort into my cover letter (http://tr.im/npLV) I finished yesterday a series of 1