On May 12, 10:29 pm, Matt Jones wrote:
> I've run across this before too, but I used something like this:
>
> %w(Admin Manager Candidate).each { |c| c.constantize }
>
> As I can never remember which one of require / require_dependency
> sometimes jams up (or used to back in the day) the autoload
Firstly I'm sorry if this is off-topic but I think it's a question
that won't be answered without good core knowledge.
I have written a multiple self join query something like this:
Person.find :all,
:select => 'children_people_3.*',
:joins => { :children => { :children => :children } },
:c
HEm 12-05-2010 13:02, Norman Clarke escreveu:
On Tue, May 11, 2010 at 16:51, Rodrigo Rosenfeld Rosas
wrote:
Norman, I checked out your multibyte branch but it is not working for me.
Here is what I did:
$ cd ~/src/rails
$ git remote add norman http://github.com/norman/rails.git
$ git remo
I have updated ticket
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4149-strange-require-behavior-in-development-environment#ticket-4149-10
with my thoughts.
Would appreciate any comments on how to go about resolving the issue
in dependencies.rb .
--
You received this messa
Yes, it worked by inserting the require statements in the
initializers.
On May 12, 12:00 pm, Kristian Mandrup wrote:
> How does the lib folder work in Rails 3?
>
> In Rails 2.x you would add require statements in application.rb, fx:
>
> /lib
> blip.rb
>
> # blip.rb
> puts "BLIP"
>
> # applicati
OK, it seems it works using autoload, being lazy loaded when accessed.
But what if I want to force it to be loaded when rails starts?
Appending a require 'blip' in application.rb I am told no such file
exists!? Would I have to insert it in an initializer?
# lib/blip.rb
puts "Blip loaded!"
class
On Tue, May 11, 2010 at 16:51, Rodrigo Rosenfeld Rosas
wrote:
> Norman, I checked out your multibyte branch but it is not working for me.
> Here is what I did:
>
> $ cd ~/src/rails
> $ git remote add norman http://github.com/norman/rails.git
> $ git remote update
> $ git checkout norman/multibyte
How does the lib folder work in Rails 3?
In Rails 2.x you would add require statements in application.rb, fx:
/lib
blip.rb
# blip.rb
puts "BLIP"
# application.rb
...
require 'blip'
---
But using the same approach doesn't work in Rails 3. How do I
configure this so that blip.rb is loaded when
On 12 May 2010 20:58, Kristian Mandrup wrote:
> On a further note. I can't seem to get any .rb files in RAILS_ROOT/lib
> to load when I start my rails server.
>
> Say I have a file
>
> # lib/auth_assistant.rb
> puts "Hello from AuthAssist"
>
> --
> In the old days of Rails 2.3+ you would put a re
On a further note. I can't seem to get any .rb files in RAILS_ROOT/lib
to load when I start my rails server.
Say I have a file
# lib/auth_assistant.rb
puts "Hello from AuthAssist"
--
In the old days of Rails 2.3+ you would put a require statement in
application.rb, but I think in Rails 3 all fil
Thanks everyone for the input. I understand what's going on now.
I will mark ticket #4516 as invalid.
On May 12, 10:51 am, Xavier Noria wrote:
> On Wed, May 12, 2010 at 4:36 PM, Mislav Marohnić
>
> wrote:
> > When you're querying a parent that doesn't have any non-abstract parent
> > (meaning
On 12 May 2010 20:49, Kristian Mandrup wrote:
> On another note:
>
> I would like to have available the methods used in Rails 3 templates.
> I see many generators including Rails::Generators::Migration and using
> the method migration_template to create a new migration.
> What I would like is for
On another note:
I would like to have available the methods used in Rails 3 templates.
I see many generators including Rails::Generators::Migration and using
the method migration_template to create a new migration.
What I would like is for my generator to create the options for
running a basic mig
On Wed, May 12, 2010 at 4:36 PM, Mislav Marohnić
wrote:
> When you're querying a parent that doesn't have any non-abstract parent
> (meaning he's the top of the STI hierarchy), then theoretically you really
> don't have to know the list of descendants. AR could just make a query
> without conditi
When you're querying a parent that doesn't have any non-abstract parent
(meaning he's the top of the STI hierarchy), then theoretically you really
don't have to know the list of descendants. AR could just make a query
without conditions. I think it would be a good addition to AR.
Or am I missing s
On Wed, May 12, 2010 at 8:50 AM, Mislav Marohnić
wrote:
> Isn't the problem obvious? ActiveRecord cannot list all subclasses under STI
> until it loads all modes in the app. In development mode it relies on
> autoloading and never preloads all models.
> The local solution: require statements in th
On 12 May 2010 19:55, Kristian Mandrup wrote:
> I worked it out myself. It had to do with the fact that the generators
> for some reason require the namespace to match a containing folder,
> much like the Java package mechanism.
>
> lib/generators
> - auth_asisst
> - ability
> ability_gene
I worked it out myself. It had to do with the fact that the generators
for some reason require the namespace to match a containing folder,
much like the Java package mechanism.
lib/generators
- auth_asisst
- ability
ability_generator.rb
# ability_generator.rb
module AuthAssist
module G
On 12 May 2010 14:50, Neeraj Singh wrote:
> User.find_by_name 'agent' generates a sql that does not use Agent or
> SuperAgent even if they are loaded.
>
> However the behavior of Agent.find_by_name 'agent' is different if
> SuperAgent is loaded.
>
> @Colin: SuperAgent should be a subclass of Agent
On 12 May 2010 19:33, Kristian Mandrup wrote:
> Hi,
>
> I've been trying to develop a Rails gem/plugin with generators for
> Rails 3. I first had a separate gem project with a gem statement in my
> Gemfile with a :path option to point at it. But then I had to run $
> rake install on each change i
Hi,
I've been trying to develop a Rails gem/plugin with generators for
Rails 3. I first had a separate gem project with a gem statement in my
Gemfile with a :path option to point at it. But then I had to run $
rake install on each change in my gem to have Rails pick up on it. I
have now instead pu
In general, if you have grandchildren you need to load them to ensure
they are known. I compute them this way:
http://gist.github.com/274219
The bottom line is that Active Record needs to know the STI hierarchy
that is relevant to any given query. That just does not play nice with
autoloading
User.find_by_name 'agent' generates a sql that does not use Agent or
SuperAgent even if they are loaded.
However the behavior of Agent.find_by_name 'agent' is different if
SuperAgent is loaded.
@Colin: SuperAgent should be a subclass of Agent. I have updated the
gist with this info.
@Mislav: Yes
On 12 May 2010 13:50, Mislav Marohnić wrote:
> Isn't the problem obvious? ActiveRecord cannot list all subclasses under STI
> until it loads all modes in the app. In development mode it relies on
> autoloading and never preloads all models.
> The local solution: require statements in the end of "u
Isn't the problem obvious? ActiveRecord cannot list all subclasses under STI
until it loads all modes in the app. In development mode it relies on
autoloading and never preloads all models.
The local solution: require statements in the end of "user.rb":
require 'manager'
require 'agent'
So w
On 12 May 2010 13:33, Colin Law wrote:
> On 12 May 2010 12:56, Neeraj Singh wrote:
>>> Since you have deleted all of the original post and my comments the
>>> above now makes no sense. No-one reading this will know what your
>>> problem is without going back to the previous mail, which is someth
On 12 May 2010 12:56, Neeraj Singh wrote:
>> Since you have deleted all of the original post and my comments the
>> above now makes no sense. No-one reading this will know what your
>> problem is without going back to the previous mail, which is something
>> one should not normally be forced to d
> Since you have deleted all of the original post and my comments the
> above now makes no sense. No-one reading this will know what your
> problem is without going back to the previous mail, which is something
> one should not normally be forced to do.
Extremely sorry about that. I have created
On 12 May 2010 11:42, Neeraj Singh wrote:
> The sql that I posted came out after testing the exact case provided
> by the author of the ticket. While composing this email I did not
> layout the full hierarchy.
>
> @Colin. It is definitely due to class loading. If in development I
> load Agent then
The sql that I posted came out after testing the exact case provided
by the author of the ticket. While composing this email I did not
layout the full hierarchy.
@Colin. It is definitely due to class loading. If in development I
load Agent then query will include Agent too.
script/console
> Agent
On 12 May 2010 04:47, Neeraj Singh wrote:
> class User
> end
>
> class Agent < User
> end
>
> script/console production
> User.find_by_name 'john'
>
> SELECT "people".* FROM "people" WHERE ((("people"."type" = 'User' OR
> "people"."type" = 'Manager') OR "people"."type" = 'Agent')) AND
> ("people".
31 matches
Mail list logo