Displaying 20 results from an estimated 2000 matches similar to: "Best practices: a little pop-quiz on my blog"
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi,
in the past few months someone posted an entry on their blog about
how to do validations in non-AR classes and I cant find it any more.
Anyone have a link?
Thanks,
Trevor
--
Trevor Squires
http://somethinglearned.com
2007 Sep 21
3
TextMate Bundle and exception when switching to alternate file.
Hey,
sorry if this is something better suited to another list.
I''ve encountered a strange problem with the RSpec.tmbundle in trunk -
namely that it was raising an exception when pressing
ctrl-shift-downarrow (switch between spec and source - "Alternate
File").
I tracked down the issue to be handling of the file_type in
switch_command.rb#content_for() - the code expected the
2005 Dec 08
2
bounce effect
Hi,
I was wondering if anyone has seen (or completed) an effect to make
something ''bounce'' like icons do in the OS X dock when you launch
them? Something that looks like there''s a bit of gravitational
behavior to it?
Thanks,
Trevor
Trevor Squires
http://somethinglearned.com
2006 Jun 08
5
update only the join table in a HABTM - how?
I have a photographers app that requires giving access to galleries for
users. in one part, I want to be able to define gallery access for a
user seperate from updating any of the user info. I have this function:
def edit_access
@user = User.find(params[:id])
@user.galleries = Gallery.find(params[:gallery_ids]) if
params[:gallery_ids]
if @user.update_attributes(params[:user])
2006 Apr 19
8
Module and Model
I am getting the following error
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1129:in
`method_missing'': undefined method `directory?'' for Msg::File:Class
(NoMethodError)
I have a model called Msg::File in models/msg/file.rb, and I have a file
in lib/msg/helper.rb which references to both Msg::File and
File.directory?
How do I help activerecord
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come
in. Console just gives me back :account_id => nil. Obviously I''m trying to
set it though. Silly console...
But, I can set the account_id column in my controller like so:
@user = User.new(params[:user])
@user.account_id = account.id
@user.save
Here''s what I give to the controller:
User.create :name
2006 Feb 17
4
Table with Constants
I would like to have a table with some constants to use them later on
for a drop down menu. How can this be done?
My table looks like
Table with constants
------------------------
id | key | value | type
------------------------
1 | M | Male | sex
....
I know it can be done like this
<% select ''object'', ''method'', Constants.find(:all, :select =>
2006 Mar 31
6
Split Validations?
I have a single table that two people enter data into. Person A creates
the record and I need to specify certain required fields in his form.
Person B has a separate form and she fills in additional fields and I
need to specify that some of these are required.
Since the data is all in one table and since the validations are in the
model, won''t Rails complain when person A tries to
2006 Jun 18
10
acts_as_enumerated
Hello All,
Any one using acts_as_enumerated? I need help using (I like that it
caches values in memory)
I am working on a dating website and there are lots of options I want to
store as enumerated like
Status; divorce, single,
Sex: male, female
Eye color; blue, brown, green....
and lots more....
But I do not wanna keep them in seperate tables, and wanna keep them all
together.
Anyone has a
2006 Mar 22
5
Class Caching Problem [was Newbie Question about Custom Classes]
So any other ideas as to why my custom class under app/models is being
cached even though all the caching is set to false in the
config/environments/* files? Currently I''m having to restart WEBrick
after EVERY change to the file. The controllers and views are
reloading just fine and not being cached. It''s just the custom class
I created that''s being cached.
Any ideas
2006 Apr 02
2
"Quiz" site
Hi,
I am thinking about how to best design a quiz site in RoR. I think it
should be fairly easy, but have run into a wall. In the simplest form,
the view would grab all of the questions for a particular quiz and
display them (e.g. multiple choice, so 4 option buttons per question).
However, I can''t figure out how to "mark" the quiz. The form is
submitted to the
2006 May 10
12
how best to implement lookup table?
Hi all -
I''d like to implement a lookup table in my app that contains some
reference data, just some status codes and their descriptions. What''s
the most appropriate approach according to the "rails way" of doing
things? Would I just implement a has_many relationship? Let''s say
these are Order status codes, would the StatusCode have many Orders?
This
2006 Mar 31
5
Model reloading problem
Hi all,
I''ve a model class Toto in the model directory.
I don''t understand why i have to restarts WebBrick to view changes i make
in this class
FYI : in the development. rb i desabled class cache with
config.cache_classes = false
Regards
Luciano
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Apr 11
11
I can''t get rails to see my plugin. How can I this?
I''m trying to produce a plugin to help me with my page caching woes. I
can''t seem to get rails to see my method within the plugin. This is my
first attempt at a plugin so I''m sure I''m missing something. I''ve
created a directory /vendor/lib/plugins/broom_stick/. I then created an
init.rb file with:
require ''broom_stick''
I then
2012 Aug 09
3
Pop quiz: Where do you watch for job postings?
Hi all, I''m looking for some advice on where we should be putting an
advert if we are looking to hire a full time rails developer? Or turning
it around what websites (or mailing lists) do folks here use to if they
feel the need for a change in view from their desk?
A few details to narrow down scope since it might affect the advice,
apologies in advance, trying to NOT make this an
2012 Aug 18
5
Quiz: How to get a "named column" from a data frame
Today, I was looking for an elegant (and efficient) way
to get a named (atomic) vector by selecting one column of a data frame.
Of course, the vector names must be the rownames of the data frame.
Ok, here is the quiz, I know one quite "cute"/"slick" answer, but was
wondering if there are obvious better ones, and
also if this should not become more idiomatic (hence
2006 Feb 02
0
proposed bugfix/patch: ActiveRecord cross-module associations
Hi,
I''m still test driving the improved support for module namespaces in
rails and I''ve hit a problem with associations between AR classes in
modules and AR classes in the root namespace.
The long and short of it is I want to be able to say:
Foo::Bar.belongs_to :wibble, :class_name => "::Wibble"
If you don''t try to prefix ''Wibble''
2006 Jun 01
3
rake create_sessions_table, does not create session table
when i run rake create_sessions_table, I get following output. tables
donot get created and my application doesnot start.
(in G:/rubysrc/blog)
create db/migrate
create db/migrate/001_add_sessions.rb
info: the first time ran take everyting was fine, but now i have
reinstalled ruby and rails and created the database, but i am unable to
create session table with rake, please help.
2006 May 05
3
Plugin refresh time
Hi there,
I''m currently developing a plugin to do authentication and
authorisation. In the init.rb file of the plugin I have this code:-
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), ''lib''))
require ''open_advantage/authorisation''
ActionController::Base.send :include, OpenAdvantage::Authorisation
and this is the skeleton of my
2006 Aug 08
3
params object nil in controller action
Hi All
I am trying to implement a Back to Search Results functionality, by storing
the user''s search criteria (params) in session and then reusing those
params instead of request params when user clicks on "Back to Search Results
link". here is my code
________________________________________________________________________
def search
if session[:incidentSearch].nil? or