similar to: putting the schema in the model files

Displaying 20 results from an estimated 9000 matches similar to: "putting the schema in the model files"

2006 May 23
8
ad-hoc query
How do you run an ad-hoc query that does not belong in any model? I thought it was something like ActiveRecord::connection.find("my query..."), but I can''t seem to find the documentation on it. I know I''ve seen it somewhere before, though. thanks, Jeff -- Posted via http://www.ruby-forum.com/.
2006 Apr 27
0
DRY validation
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, A few months ago someone posted a message about specifying validates_* constraints on a per-attribute basis. I just created a small plugin that allows you to do this. Here''s an example from one of my models: class Country < ActiveRecord::Base attribute :name, :string do |a| a.validates_length :within =>
2006 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results when using "acts_as_ferret". At the moment my search code is.. def search @query = params[:query] || '''' unless @query.blank? @results = Tutorial.find_by_contents @query end end Cheers SchmakO -- Posted via http://www.ruby-forum.com/.
2017 Nov 10
2
[RFC] Making .eh_frame more linker-friendly
> But if we still need to deal with CIEs and generate .eh_frame_hdr in a special way, > does it make sense to make this change to simplify only a small part of a linker? For huge C++ projects this could improve link time if GC is a bottleneck. It will also improve eh_frame_hdr build time because you don’t spend time on parsing garbage. However a linker will have to have two versions of GC:
2005 Apr 18
7
Shorewall and IPv6
How is the effort to make Shorewall do iptables6 going? -- Patrick "Diablo-D3" McFarland || pmcfarland@downeast.net "Computer games don''t affect kids; I mean if Pac-Man affected us as kids, we''d all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." -- Kristian Wilson, Nintendo, Inc, 1989 --------------
2005 Jul 26
3
Generating unique random tokens for ActiveRecord objects
I have an ActiveRecord subclass that needs to generate a random (hard to guess) token for each record in its corresponding table. Currently I''m doing something like this: def before_create self[''token''] = random_value while self.class.find_by_token(self[''token'']) self[''token''] = random_value
2017 Nov 10
2
[RFC] Making .eh_frame more linker-friendly
Hi Igor, > It sounds like the linker has to be aware of the .eh_frame section details to be able to generate .eh_frame_hdr and eliminate duplicate CIEs, right? Yes, a linker needs some details but not all of them. It needs to know sizes of records and initial locations (PC Begin) to find out which functions FDEs belong to. > So, is there any difference whether it knows that in one place
2007 Feb 04
10
[AAF] remote indexing via DRb with acts_as_ferret
Hi! Aaf trunk has undergone several major refactorings the last days, with the result that you can now transparently switch your app from local to remote indexing and back :-) If you plan to scale your app to more than one physical machine, or if you have problems with corrupted indexes and the like under high load, you really should give this a try. I wrote some documentation to get you
2007 Oct 03
3
Pagination problem with acts_as_ferret
Hi, am using this wonderful plugin acts_as_ferret and according to the tutorial at http://railsenvy.com/2007/2/19/acts-as- ? rial#basic I worked it out except the pagination feature. If I have 12 records and I give limit to 10, its correctly displaying 10 records in the first page and is giving the link to the second page too. But when I go to the next page I find the same 10 records instead of
2009 Mar 15
5
Setting DEFAULT_FIELD_OPTIONS in Rails 2.3
Hi, I''m having some trouble overriding/defining the default_field_options constant without raising a warning. I''ve tried adding the code to do it in an initializer but that produces a warning (because the constant is already frozen), after some googling I found a recommendation to put it in the environment.rb file but that then that throws uninitialized constant ActionView
2007 Jan 01
5
Validations based on associations
My model is very simple, it''s mostly just a join table that represents which tournaments a user has registered for. class Registration < ActiveRecord::Base belongs_to :user belongs_to :tournament validates_presence_of :user_id, :tournament_id validates_uniqueness_of :user_id, :scope => :tournament_id end the validates_uniqueness checks to make sure there''s no
2006 Nov 20
22
Index only partially built
I have an application which I''m running using Mongrel and Apache as described here http://www.napcs.com/howto/rails/deploy/. I have a model Person which I am attempting to use acts_as_ferret with. When I first try to do a search the index begins to get built but it its fails halfway through with the following error in the browser: === Proxy Error The proxy server received an invalid
2007 Sep 05
1
AAF and DRb with highlighting
How would I change this method in order to get highlighting working with DRb? I''ve given up on searching on Google, I''m getting no results that are actually helpful. def self.find_storage_by_contents(query, options = {}) # Get the index that acts_as_ferret created for us index = self.aaf_index.ferret_index results = [] default_options = {:limit => 10,
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
In my model Topic: acts_as_ferret({ :fields => {:username => {:store => :yes, :boost => 30}, :subject => {:store => :yes, :boost => 20}, :body => {:store => :yes, :boost => 10}}, :remote => true }, { :analyzer => Ferret::Analysis::RegExpAnalyzer.new(/./, false) }) def self.full_text_search(q, options = {}, find_options = {}) return nil if q.nil? or
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code: @project_pages, @projects= paginate :project, :per_page => 10, :conditions => ["account_id = ?", account] ?! If only I could pass the sub-collection account = ... @projects = account.project to paginate, instead of letting it extract it with a find :all + sql conditions Alain. -- Posted via
2009 Oct 04
2
no such file to load -- restClient (MissingSourceFile) HELP
i don''t get what is going on here. if i run the restclient command that starts an irb with restclient it works fine but when i try to load it from environment.rb with require ''rest_client'' this is what i get... it''s driving me batty. /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'': no such file to load --
2007 May 24
2
Missing RspecScaffoldGenerator
Just a quick note that I had to make the following change after installing 1.0.2 as rails plugins to get the resource generator working: Index: rspec_scaffold_generator.rb =================================================================== --- rspec_scaffold_generator.rb (revision 2022) +++ rspec_scaffold_generator.rb (working copy) @@ -1,4 +1,4 @@ -class RspecResourceGenerator <
2006 Jul 31
9
Multiple Pagination
I have the following: def index begin @restaurant_pages, @restaurants = paginate :restaurants, :order => (params[ :sort ] || "name"), :per_page => 2 @cuisines = Cuisine.find_all rescue redirect_to :action => :index end end # sort by cuisine def
2009 Oct 13
2
Single Table Inheritance (STI) Broken: NameError
Some how I''m getting NameError: uninitialized constant when accessing a child models that inherits form the parent model. However, if I access the parent model first, then the child model is resolved. What am I doing wrong? My steps are below... Thanks, Francis. > ./script/generate model Blah type:string class CreateBlahs < ActiveRecord::Migration def self.up create_table
2006 Apr 13
2
running rails on Linux
I''ve done local installs of ruby-1.8.4, then rubygems-0.8.11, then: % gem install rails I get rails and its dependencies all going into: /local/pkgs/ruby-1.8.4/lib/ruby/gems/1.8 i.e. /local/pkgs/ruby-1.8.4/lib/ruby/gems/1.8/gems/rails-1.1.2 In the rails directory I see: /local/pkgs/ruby-1.8.4/lib/ruby/gems/1.8/gems/rails-1.1.2/bin/rails which I presume is what is executed when