similar to: Parameterized ActiveRecord Associations: Any such thing?

Displaying 20 results from an estimated 500 matches similar to: "Parameterized ActiveRecord Associations: Any such thing?"

2006 Mar 29
4
Scaffold generator: create vs. new
Can anyone supply me with a simple, succinct explanation of what the difference is between the "new" controller and the "create" controller that the scaffold generator produces? I run: > script/generate scaffold modelname controllername And now I need to do some work inside the controllername.rb file. For example, pulling a list from another database table to supply
2011 Sep 28
3
Error : bundle install
c:proj/proj1> bundle install Fetching source index for http://rubygems.org/ Could not find sprockets-2.0.0.beta.10 in any of the sources C:proj/proj1> C:proj/proj1>gem install sprockets -v=2.0.0.beta.10 ERROR: Could not find a valid gem ''sprockets'' (= 2.0.0.beta.10) in any reposito ry ERROR: Possible alternatives: sprockets C:proj/proj1>gem install sprockets
2012 Dec 18
2
cache-busting non-digest assets in sprockets in development a good idea? should headers in sprockets be configurable?
Just monkey patched Sprockets in our Rails 3.2.9 app to override the Cache-Control header for html assets that we need to tweak more often in development, but that we don''t want to use digests/fingerprinting with: # Sprockets 2.x patch if Rails.env.development? module Sprockets module Server private alias_method :sprockets_headers, :headers def headers(env,
2012 May 07
1
Sprockets, JST, Eco and escaping
While it was a good move from Rails part to escape ERB <%= %> tags by default, it doesn''t seem to happen to Sprockets as well. The strange bit is that according to Sprockets documentation, it would be just a matter of naming your template as .jst.eco to enable Eco: https://github.com/sstephenson/sprockets#javascript-templating-with-ejs-and-eco Then, extracted from Eco
2011 Nov 10
1
url helper in model.js.erb.cofee (Sprockets::Context)
hello, I am writing a js/coffee file that gets erb handling and I need to use a url helper inside this file if write .. url: ''<%= url_for(:action => :index) %>'' I get an error: NoMethodError Exception: undefined method `url_for'' for #<#<Class: 0xbdbb068>:0xeed1eb8> >>self.class #<Class:0xbdbb068> < Sprockets::Context How do I
2011 Sep 01
7
couldn't find file 'jquery' rails 3.1 stable mountable engine
When I create a new engine in Rails 3.1 stable and then access the dummy app or the engine I get an error say that the app can''t find jquery. I''ve created the engine using rails plugin new coffee --mountable I''ve also created a basic controller in the engine and the dummy app. If I remove the javascript include tag, everything works. But with the tag there it just
2009 Jul 23
11
Problem with named_scope
Here are my scopes: default_scope :order => ''posted_on DESC'', :conditions => { :status => ''visible'' } named_scope :positive, :conditions => { :rating => ''positive'', :status => ''visible'' } named_scope :neutral, :conditions => { :rating => ''neutral'', :status =>
2011 Aug 25
2
Problem with rails generaterspec:install, Error-Message: no such file to load, sprockets-railtie (loadError)
Hey guys, I''m a RoR-Beginner and I started learning it with the RoR-Tutorial. Actually I''m at this chapter (http://ruby.railstutorial.org/chapters/ static-pages#top) and try to install rspec. But everytime when I try to use "rails g rspec:install" I get this error message: C:\Sites\rails\rails_projects\sample_appp>rails g rspec:install
2004 Apr 08
1
Two operators, 10 rollover lines, Cisco 7960G chanisavail problem
Here's my situation. I have two receptionists that answer incoming lines. Each has a 7960G with 5 incoming lines each. I'm trying to set this up so each line on each phone doesn't utilize call waiting. My problem seems to be that ChanisAvail(Sip/cisco1&Sip/cisco2&Sip/cisco3&Sip/cisco4&Sip/cisco5) always returns cisco1. Here are the sip.conf entries: (mind you,
2011 Oct 25
0
Sprocket Digest + Debug combination broken?
Hi all, we''re just in the process of upgrading to the new asset pipeline, but I''m having an annoying issue with Sprockets. It turns out that I can''t enable both *debug* and *digest* in development mode. When I do, I get a Errno::ENAMETOOLONG because the digest becomes the *entire* *content* of the file instead of a hex. I get this with both sass and javascript.
2010 Sep 01
4
deprecation warning in Rails 3 about Base.named_scope
I recently upgraded to Rails 3, and this error has come up ubiquitously: DEPRECATION WARNING: Base.named_scope has been deprecated, please use Base.scope instead. Any ideas on how to get rid of it? Or should I just wait for something? There''s actually no place in my application where the code "Base.named_scope" exists, so I assume the problem is inherent in gems that
2011 Dec 05
9
jquery - word is not defined
Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me) Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class So I''m using... app/assets/javascripts/people.js.coffee and put in...
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType, making it possible to express facts such as "Clint Easterbunny is director of the movie Gran Milano". The relevant model and associations look like this class Movie < ActiveRecord::Base has_many :roles, :include => :role_type, :dependent => :destroy has_many :participants, :through => :roles, :source
2010 Jan 15
1
Chaining queries in ActiveRecord
Hi all, Stuck at this problem for several days. Tried to use named_scope, scope_out, and plugin such as searchlogic, but no result. The problem is as follows: I have a pic table and tag table, and a join table called pic_tag (with only pic_id and tag_id) so that I can associate N pics to M tags. This is the tutorial way to set up a many- to-many association. I''m trying to implement a
2010 Apr 07
3
Recommendation for searching with regards to timestamp & foreign key attributes
hi guys, I need a recommendation for searching with regards to timestamp & foreign key attributes. Sounds a bit too much but here''s an example. Suppose we have a "blog" object. It has many attributes such as - title - content - status_id - created_at - updated_at There are also "status" objects which have the following statuses, "new",
2009 Jul 11
2
offeride :limit named_scope default_scope
Hi, Rails 2.3.2 class TestD < ActiveRecord::Base default_scope :limit => 12 named_scope :limit, lambda { |num| { :limit => num} } end ruby script/console >> TestD.all TestD Load (0.7ms) SELECT * FROM "test_ds" LIMIT 12 => [] >> TestD.limit(14) TestD Load (0.3ms) SELECT * FROM "test_ds" LIMIT 12 => [] Any ideas why the default limit
2008 May 22
14
Specifying certain tables NOT to be cleared each example?
Is it possible to specify that certain tables not be cleared on each example. I''ve inherited a project where a good amount of enumerated data is stored in the database (US States, statuses, about 15-20 tables worth. Over all, it''s a reasonable decision that leads to solid production code (acts_as_enumerated is good). This data is read-only and relatively static; any
2008 May 13
6
Testing that named_scope is defined
Hi guys, I''m just beginning to use RSpec and I ran into the issue of testing a named_scope. I''m not actually trying to test its behavior, as it''s not my code, but I wanted to test at least that it''s defined. I tried doing this: describe Post, ".most_recent" do it "should be defined" do Post.method_defined?(:most_recent).should be_true
2009 Nov 01
1
please help - complicated polymorphic association
I am trying to build a shared-appointment system, where users can subscribe to appointments and be updated whenever changes are made to them. I have three objects in this system, appointments, users, and subscribers. Subscribers are a polymorphic object like so: class Subscriber < ActiveRecord::Base belongs_to :user belongs_to :subscribable, :polymorphic => true end The tricky part is
2010 Jun 26
4
Time-dependent values/constants in Models: An issue or not?
Hi there, I remember reading in the comments of a Rails blog something along these lines: "Since a Model is loaded only once in production development (at server start), certain time-dependent ''constants'' that you have placed in a method of a Model will always return the same value for those ''constants'', i.e. the value the ''constant'' had