Displaying 20 results from an estimated 8000 matches similar to: "Pretty HABTM check boxes"
2006 Feb 22
8
filtering "tags" via checkboxes - HABTM
First post/newbie post... bear with me.
What I''m trying to achive (music site):
A system containing tracks and moods with a HABTM relationship. I''ve
got all that set up and functioning in the admin environment - i.e.
admins can apply a variety of moods to a particular track via a
series of checkboxes. Join table works just fine.
I''m currently stuck on allowing
2006 Apr 03
4
Clearing out filters in ActionController
I want to run a single filter in my application.rb file, and then if a
certain condition is true, end the action''s processing immediately.
Right now I''m using prepend_before_filter to ensure that it gets run
first, but some of my around_filters are still being processed. Is
there a way that I can clear out all the filters that should be run?
Basically it''ll look
2006 Mar 14
3
Help doing find - look for nonempty habtm
I''ve got a Cuisine and a Restaurant model, with a habtm. One thing I
want to do is find all the cuisines that have at least one restaurant
associated with them. Right now I''m using the following SQL query:
SELECT DISTINCT(cuisines.*) FROM cuisines, restaurants,
cuisines_restaurants WHERE cuisines.id =
cuisines_restaurants.cuisine_id AND restaurants.id =
2007 Jan 01
3
Another "how do I spec this?"
I wanted to add a convenience method on my User class to see if he was
already signed up for a tournament. Here''s my spec
context "A User signed up for one tournament" do
setup do
@t1 = Tournament.new
@t1.save false
@t2 = Tournament.new
@t2.save false
@user = User.new
@user.save false
@user.registrations << Registration.new(:tournament =>
2006 Dec 20
16
Edge RSpec on Rails...what did I forget?
Started a new Rails project, and installed RSpec and the Rails plugin
vendor/plugins/rspec (svn://rubyforge.org/var/svn/rspec/trunk/rspec) - 1332
vendor/plugins/rspec_on_rails
(svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails/vendor/plugins/rspec_on_rails)
- 1332
Generated the rspec file, created a model...the spec runs fine if I do
ruby spec/models/foo_spec.rb. Running rake though gives
2007 Mar 14
5
What''s the new syntax for predicates?
@settings.should allow_publish_ip("127.0.0.1") fails with
undefined method `allow_publish_ip'' for #<#<Class:0x2f8fd48>:0x2f5a968>
@settings.should_allow_publish_ip("127.0.0.1") works fine
This is rspec 0.8.2.
http://rspec.rubyforge.org/documentation/expectations.html says that
matching arbitrary predicates is deprecated and to see
2007 Nov 12
15
it "should [action] ..." vs it with an active voice
I''d like to start gathering information/debating on the
advantages/disadvantages of using it "should ..." vs other techniques.
Dan North explained why we should use should:
http://dannorth.net/introducing-bdd/
I used to use it "should ..." for the projects I was on, until I was
challenged by a fellow developer who started using it with an active
voice.
For example
2006 Nov 03
10
[PLUGIN] rspec_resource_generator - RESTful scaffold generator with RSpec specifications
rspec_resource_generator
========================
By Pat Maddox
Use this generator to generate RESTful scaffolding with RSpec specifications.
Syntax is exactly the same as the scaffold_resource generator:
./script/generate rspec_resource ModelName [field:type field:type]
When you run this generator, it will create a migration, model, and
model spec file. In addition, it gives you a RESTful
2006 May 30
3
extra attributes in habtm
Hi,
Posting here since issue tracking isn''t the best place to discuss.
I can understand habtm is moving towards deprecating support for extra
attributes in join_table, and to use :through for those cases instead.
To clarify, patch<http://dev.rubyonrails.org/attachment/ticket/5216/habtm_join_table_test.patch1.diff>for
#5216 <http://dev.rubyonrails.org/ticket/5216>
2006 Jul 22
12
Community request - can someone show me REST?
I mentioned this in another thread, but I''ve got a formal request now.
After reading tons of stuff about REST, I don''t really get it. I
need to see an example.
I''d like someone to write up an example blog app with these requirements
- RESTful using the simply_restful plugin (or edge rails)
- allows posting of comments to articles
- has categories for posts
No need
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server
though, I want it to load from a file when I call find. Any clue how
I do that?
Pat
2006 May 24
2
"Stack Level Too Deep" issue in HABTM Unit / Functional Test
Hello guys. I was able to figure out that my "stack level too deep"
error I was getting with my HABTM destroy method was the result of a bug
in rails 1.0. I upgraded to 1.1.2 and now the views and any console-run
commands for destroying AR objects linked together via HABTM work just
fine.
I have HABTM setup between stories and submissions.
The issue is that the destroy methods in
2005 Dec 12
9
Webrick is being stupid...no info on a brand new project
I created a project, made a migration, generated scaffolding...start
up webrick and I get nothing. To simplify things, I just started
another project and generated a controller, still getting nothing.
The index page loads fine, but nothing beyond that. If I go to
anything that should give me a 404, the page is just blank. The
Webrick console just says a 500 (nothing explaining why), and
2006 Jun 05
7
Is HABTM Dying?
For a while, I''ve been getting that HMT is replacing HABTM. It appears that
HMT can do all of what HABTM can do and more. The question is: Should I stop
using HABTM? Let''s take a simple case:
A case has many categories
For a given category, there are certain valid statuses
Category
has_and_belongs_to_many :statuses
Status
has_and_belongs_to_many :categories
Question:
Is
2006 Jun 07
6
I want to stick my models in a module
I''ve got enough models now that I''d like to separate them into
modules. For example, I have the class Player that I want to stick in
the Trainer module. I''ve changed the definition to
class Trainer::Player
I''ve created a models/trainer dir, test/unit/trainer, and
test/fixtures/trainer. Change the PlayerTest class to be
Trainer::PlayerTest. I get the
2006 Feb 16
1
HABTM -VS- belongs_to/has_many, for self-referential joins
Ok, David says on page 241 that sometimes a many-to-many relation with
attributes are better implemented as an actual model instead of using HABTM.
Well, I''ve got that situation and I can''t figure it out.
All of the examples in the book have HABTM examples between 2 different
tables, but I want to have a HABTM relation on 1 table with itself. (e.g.,
if I have a table Things,
2006 Jun 30
2
how to HABTM with STI ??
Hello all
This is my first post so excuse the basic question. (and any repeats I just
got an email saying this post was too big so I have re-submitted a smaller
version)
I was following the thread on
http://lists.rubyonrails.org/pipermail/rails/2006-May/038988.html regarding
the STI on HABTM for RoR.
I have a very similar problem and was hoping for some help.
I have the
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which
looked like
specify "should render abc123" do
controller.should_render :text => "abc123"
get :key
end
With 1.0.0, the new spec is
it "should render abc123" do
get :key
response.should render_text("abc123")
end
However it doesn''t work, giving me the error:
undefined
2007 Sep 04
7
Rake tasks getting in the way of edge (uses gem instead)
So I''d been running gem releases of rspec for the past several months,
and I installed edge rspec so that I can use Story Runner.
I''m running into a problem because I''ve got a couple rake tasks that
reference "spec/rake/raketask". If I try to run "rake spec" then it
pulls in the gem version instead of the plugin version. rake blows up
saying that
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a