Displaying 20 results from an estimated 20000 matches similar to: "Getting table field names from an object"
2007 Nov 17
18
Syntax Problem
I admit I am stuck. I am converting a legacy php site to ROR. The old
site uses MD5, a security flaw waiting to happen. I upgraded to AAA
and am adding code in the session_controller.rb file to see if
crypted_password is blank. If it is, crypt and check the password
against the old md5 version and write it in the new crypted_password
field.
Here is my code add on before the logged_in?:
def
2007 Nov 04
4
Hidden URL
Hello,
I have in my application a private public URL. For those who know
Flickr, it is sorta like the URL you give to your friend for them to
access your photos. Usually the URL looks like this:
http://www.domain.com/url/khjuytf678ysdfksdgihsd
Where "khjuytf678ysdfksdgihsd" is an encoded path. Let say I want to
have a public-private page for:
2006 May 11
3
undefined??
When following the ONrails "Rolling on Ruby with Rails" tutorial part1 I
(already) encountered the first complication.
After doing those basic actions to set up the basic site, the tutorial
tells me to overwrite the "list" method included in the "scaffold
:recipe" method which we find in the recipe controller with this code:
def list
@recipes = recipe.find_all
2006 Jan 19
6
One Last Question for me..
And then I should be ready to roll with my project.. I have some fine
tuning of the looks to do after, but funtionality first!
This is probably a rails question.. but I''m not sure where to sign up
for the rails questions email group? (I guess I turned this into a 2
question email).
I''ll ask here and then if someone will send me the url of where I go
to sign up for the rails
2007 Oct 12
7
webrick 500 error
Hi,
This is my second question on the poor performance of webrick
(previously I had a problem with Ajax).
I have a somewhat simple Rails application which works just fine, but
when I come back to work the next day, the server responds with error
500. It looks like if it is running more than 12 hours, it''ll crap-out.
I don''t use CVS (which I read on the web it is a common cause
2007 Oct 26
2
Appending to a textarea with RJS
Ok, this is driving me nuts. I''m trying to RJS some text into a
text_area which may or may not have been written in by the user. if I
page.insert_html :before, :after, :top, or :bottom, it either sticks
the contents above or below the text box (but never in). If I do:
page[:textboxid].value = "blah"
it overwrites the contents of the textbox but doesn''t APPEND to it.
2005 Sep 25
7
(newbie) Missing Template Error using Rolling With Rails Tutorials
Hi all,
New to the list, Ruby, & RoR. I''ve been going through the Rolling
With Rails tutorial, but am getting the following error when the
instructions tell you to add the @recipes = Recipe.find_all line to
the RecipeController:
Template is missing
Missing template ./script/../config/..//app/views//recipe/index.rhtml
The index.rhtml file is right where it''s supposed to
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 Apr 25
3
select boxe
yop,
http://rubyonrails.org/api/classes/ActionView/Helpers/FormHelper.html
ici j''ai vu qu''on pouvait g?n?rer des ?l?ment d''un formulaire gr?ce des
m?thodes. Apres quelque petite recherches j''ai trouv? comment g?n?rer un
select
<%= select(''category'', ''category.id'', Category.find_all.collect {|category|
category.nom})
2006 May 24
6
newbie question: missing template
Hi
I''m new to this forum and new to Rails so excuse me if this is a daft
question.
I''m following the ONLamp.com tuturial and all has been well untill
changing the template for the recipes. I have followed the instructions
and added this code to the controller:
class RecipeController < ApplicationController
scaffold :recipe
def list
@recipes = Recipe.find_all
end
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to
unit test instance variables that are created by actions. It was
more difficult than I expected. It seems like there should have been
a more straight forward way to do this. Can someone enlighten me? A
simplified and somewhat contrived example of what I am current doing:
Thanks.
Matt
>>
# My Controller of interest
2007 Sep 15
3
check_box_tag always checked
#check_box and #check_box_tag are going to be the end of me. Why is
this always checked?
<% checked = @reservation.selected ? ''checked'' : nil %>
<td><%= check_box_tag("reservation[" + @reservation.id.to_s +
"][selected]", ''checked'', :checked => checked) %></td>
2007 Oct 13
4
Chapter 9
Hello,
I''m currently stunk on this issue for few days and I do not know how
to get it fixed.
The system always raises this error message :
order is closed
and here is my order.rb:
class Order < ActiveRecord::Base
include ActiveMerchant::Billing
before_validation :set_status
attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at
attr_accessor
2006 Mar 29
11
why belongs_to does not like validation?
This works :
class Recipe < ActiveRecord::Base
belongs_to :category
end
But (when I add validation) this does not work :
class Recipe < ActiveRecord::Base
belongs_to :category
validates_length_of :category, :within => 6..20
validates_uniqueness_of :category, :message => "already exists"
end
thank you
--
View this message in context:
2007 Nov 01
5
monster method (too hard for my skill level)
I need to write a method for calculating the fee for medical
procedures with respect to area. I have all the tables and data but
its hard to give that here. Can someone take a look at this ''stub''
method and help me out?
def calculate_fee
# strip out the first 3 numbers of the user entered zip code
# use those 3 numbers to identify row in [zipcodes table] (between
upper and
2006 Jul 09
8
find_all order question
How does one properly get find_all to grab the data from the DB table
ordered by a specific column?
For example:
@anglers = Angler.find_all
This code gets all the angler records and they are sorted in order of
the id field which is of course set as a primary key in the DB (mysql).
I''d really like to pull the data from the DB sorted in the order of
another field, for example
2007 Nov 29
6
Locomotive: Can not install mysql gem
I''m using Locomotive on MacOSX 10.4, and I have installed mysql
5.0.45.
To my surprise, the Ruby version included in Locomotive does not come
with the mysql
gem installed, so I tried to install it manually. According to the
instructions in database.yml,
this should be done using the --include switch, like this:
gem install mysql -- --include=/usr/local/lib
I selected the mysql 2.7
2006 Aug 14
2
finders et sous-classes
Bonjour, c''est ma premi?re question ici car d''habitude il me suffit de
parcourir de tels forum pour trouver r?ponse ? mes questions.
Donc cette fois, c''est du s?rieux, je n''ai pas r?ussi ? trouver la
moindre ?vocation ? mon probl?me.
Je vous explique.
J''ai une famille de mod?les :
class Attachement < ActiveRecord::Base
...
end
class Illustration
2006 Mar 03
13
Listing help
Hi,
I''ve created a Rails application and am having a problem listing by a
particular category in an associated table. I followed the instructions
found at the O''Reilly tutorial
(http://www.onlamp.com/pub/a/onlamp/2005/03/03/rails.html?page=3) but have
not had success. Can anyone please outline a better set of instructions
than in the "Showing Recipes in a
2008 Jan 16
4
[ADV] The Ruport Book : Your guide to mastering Ruby Reports
Hi folks,
I am pleased to announce that Mike Milner and I have finished the
Ruport Book. We have published it under our own company (Rinara Press
LLC) through Lulu.
With the help of the Ruport community, we''ve refined the book over the
last few weeks to meet the needs of our users. We think it will be a
great help to anyone trying to learn how to do reporting in Ruby /
Rails using