similar to: count and result

Displaying 20 results from an estimated 3000 matches similar to: "count and result"

2006 Jul 30
8
Method_missing from Ruby for Rails book
I''m having a problem getting this example from the book to work: class Cookbook attr_accessor :title, :author def initialize @recipes = [] end def method_missing(m, *args, &block) @recipes.send(m, *args, &block) end end cb = Cookbook.new cb << recipe_for_cake cb << recipe_for_chicken beef_dishes = cb.find_all {|recipes| recipe.main_ingredient ==
2006 Jul 17
14
REST Relationship Models
I''m trying to figure out an elegant way to do this: I have the following three tables: people, employer, employees And consequently the following three models: class Person < ActiveRecord::Base end class Employer < ActiveRecord::Base has_many :employees end class Employee < ActiveRecord::Base belongs_to :person belongs_to :employer end I want to be able to say:
2006 Jul 31
2
[UPDATE] More info on RubyConf 2006 registration
Hi -- Registration for RubyConf 2006 is still scheduled to open on August 2, in the early evening Pacific (US West Coast) time. Also, there''s more info at http://www.rubycentral.org/conference (e.g., the fact that this year we''re only taking credit cards, etc.). David P.S. Any LA area Rubyists around? I''ll be there this week doing Rails training. --
2006 Aug 08
12
delete_if doesn''t work for has_and_belongs_to_many
I''m using Rails-1.1.4 with Ruby-1.8.4 So let''s say I have 2 model classes: class Item has_and_belongs_to_many :things end class Thing has_and_belongs_to_many :items end i = Item.new i.things << Thing.new( :value => "Something").save i.things << Thing.new( :value => "Something Else" ).save i.save Fine, now I have two records in the
2006 Jul 26
2
newbie - HABTM confused...
I have a users table. I have a assignment table. and I have to log in to see my assignments. i can and I hasve a session id. I can make a new assignment and save my id in the user_id field of the assigment table. I want to share my assignments. so I can create a assignments_users table. this way I can have assignment 1 shared with user 1 and 2. and If I log in as user 1 or 2 I see the assignment.
2006 Aug 10
6
Partials - asked before never got reply
I''m trying to figure out how multiple partials in one page would be configured when they are based on some action in the controller. As an example - I have a main/welcome page. If someone new or a user not logged in arrives at this page I display both a registration form and a login form. However, if they are logged in then those forms should not show up on that page. Also should
2006 Jul 11
4
Variable Losing it''s Value
I fired up my rails app after a few weeks, only to find it was broken, in that the variable seems to be losing it''s value somewhere between the controller and the view. I''ve broken it down to the absolute simplest test, and here is what I get: THE CONTROLLER (controllers/visits_controller.rb) class VisitsController < ApplicationController def list @test = "test"
2006 Jul 16
17
AWDWR question
In an early section on Action View, showing code being put directly into the rhtml file: <% require ''date'' DAY_NAMES = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday } today = Date.today %> <h1>Hello, Dave</h1> <p> It''s <%= DAY_NAMES[today.wday] %>. Tomorrow is <%= DAY_NAMES[(today + 1).wday %>. </p> I get this
2006 Jul 12
12
pass hash as parameter
Hello, How can I pass a hash as parameter from a template with url_for? e.g. : if I have test = { :a => "a", :b => "b" } How can I pass that with my request? Is it possible to pass nested hash''es to? Right now, url_for :action => :test, test doesn''t seem to work. Thank you, --
2006 Aug 07
2
Getting an array of ids from form checkboxes?
Is it possible to set up a list of checkboxes so that the form parameters are given in an array (eg {"delete_list" => [3,6,7]}) ? At the moment I''m using <%= check_box_tag "delete_list[#{post.id}]" %> ...which gives parameters looking like {"delete_list" => {"3" => "1", "6" => "1",
2006 Jul 13
3
not quite getting ajax to work..
this might not be an ajax problem.. but i am stumped.. to cut out all the mess, here''s what i have a controller with this code: def test render(:layout => false) @data = params[:newOpp] end a partial which contains a form that has a button like this: <%= submit_to_remote("confirm","Confirm Entry", :url => {:action =>
2006 Jul 19
1
Eval class
Hello I wanna create class on the fly, this class is generate in method, it need eval a class and instace a new object of this class. How i do it? Bruno -- Posted via http://www.ruby-forum.com/.
2006 Jul 09
2
filters
Hi, ...i''m fairly new to ruby on rails, so maybe this is a simple question, but i''ve been racking my wits for a while now, but i can''t figure out why this isn''t working... i''m implementing some kind of a questioniere, so that when a user picks a certain answer, the value of that answer goes into a session variable that stores the amount of points
2006 Jul 12
5
DRY version of RoR book PAYMENT_TYPES example
In the book there is an example how to convert DB payment value to more readable from. PAYMENT_TYPES array is defined and then in your views you can use it as Order::PAYMENT_TYPES. The problem is: how should I convert DB values (for example with type char(1)) to full string representation. I know that I can add a Hash to a model: IM = {''S'' => ''Skype'',
2006 Jul 20
19
Recipes versus Ruby for Rails: what''s best after Agile?
For expats from other languages, what''s the next best step after the Agile Web Dev book: Rails Recipes or Ruby for Rails? Thanks, -- Austin -- Posted via http://www.ruby-forum.com/.
2006 Jul 28
8
Manning Ruby/Rails contest
Manning is running a contest: If you make the winning entry, you''ll win a $100 Manning Gift Certificate (hey, that''d be two copies of David''s awesome Ruby for Rails). the contest is to complete the phrase: Ruby is to Rails as ___________ is to __________________ The contest is at: http://www.manning.com/black/contest.php -- thanks, -pate
2006 Jul 09
6
ajax effects
Hi, i was wondering if there was some kind of general line of code i could add to my application, anywhere i suppose, that would generate some kind of effect to notify the user that an effect is happening...it could be a box on the top of the screen or something, that would be like the small bar at the end of the browser that shows the user the status of a loading page ... i was hoping
2006 Jul 15
6
Subversion and migrations confusion
I''ve spent the last several months learning RoR and building my first app. I''ve not used migrations yet and honestly don''t understand them much, and have not had my app under version control. I''ve decided it''s time (I know, some will say way past time ;-) ) to put the app under version control. I''ll be using Subversion and have begun working
2006 Aug 08
2
Problem with plurals, migrations?
Hi, Ruby 1.8.4 Rails 1.1.4 Windows XP Pro I''m hitting an issue with migrations that I suspect relates to pluralization. Here''s the migration: class Hardware < ActiveRecord::Migration def self.up create_table :hardware do |h| h.column :vendor, :string, :limit => 32 h.column :model, :string, :limit => 32 end
2006 Jul 14
6
Don''t understand :: in ActionController::Base
Maybe this should apply to Ruby forums directly, but I''ll try here. I understand the concept of classes and subclasses thanks to the excellent "Programming Ruby - The Pragmatic Programmer''s Guide". However, I don''t understand what :: signify in terms of inheritance, parent and child in e.g. ActionController::Base -- Posted via http://www.ruby-forum.com/.