Displaying 20 results from an estimated 900 matches similar to: "Getting the module name with ObjectSpace..."
2006 Jan 19
3
Why does Object.subclasses_of ignore subclasses within modules?
ActiveSupport provides a method Object.subclasses_of, shown below:
def subclasses_of(*superclasses)
subclasses = []
ObjectSpace.each_object(Class) do |k|
next if (k.ancestors & superclasses).empty? ||
superclasses.include?(k) || k.to_s.include?("::") ||
subclasses.include?(k)
subclasses << k
end
subclasses
end
Can anyone shine some light on why
2007 Jan 18
8
How can I find out which attribute is screwing up pluralize/singularize?
Hey there :)
I''m creating this app on top of a legacy database, that has a mixture
of auto_inc ids, non-''id'' named pks, non-integer-pks, foreign keys that
end in _code instead of _id, etc.
I have the model working great in the console, where I can create any
modeled object and reference other objects without issues.
However, I''m running into problems with
2006 Jul 09
1
Accessing the name of a controller''s module?
If I''m redirecting to a log in page, and saving the controller and
action name in the session hash, how do I also save the controller
module?
After the log in is completed, I can''t redirect back to the originally
directed page because it''s in a different controller module. For the
controller action name I can use the ActionController instance method
controller_name(),
2006 Jan 18
0
subclasses_of - why does it ignore subclasses within modules?
ActiveSupport provides a method Object.subclasses_of, to give the
subclasses of a given class. However, it ignores any subclass within
a module, so :
class A
end
class B < A
end
Object.subclasses_of(A) # returns [B]
module C
class D < A
end
end
Object.subclasses_of(A) # returns [B], even though C::D is also a subclass of A
class E < C::D
end
Object.subclasses_of(A) # returns
2009 Aug 10
0
A rails sitemap plugin
Hi, guys:
I wrote a sitemap plugin for rails yesterday. This plugin will
generate the public/sitemap.xml from config/sitemap.rb whose format is
very familiar to config/routes.rb.
I think it is very helpful if you have a website written by rails and
want it to be crawled by spiders such as google, yahoo and baidu.
The home page of the plugin is http://github.com/flyerhzm/sitemap/tree/master
The
2009 Sep 13
0
regrex_crawler -- a crawler which uses regular expression to catch data from website
RegexpCrawler is a crawler which uses regular expression to catch data
from website. It is easy to use and less code if you are familiar with
regular expression.
The project site is: http://github.com/flyerhzm/regexp_crawler/tree
I give an example: a script to synchronize your github projects except
fork projects, , please check example/github_projects.rb
require ''rubygems''
2011 Jul 14
0
subclasses with inherited_resources?
I''m trying out inherited_resources and so far so good. However, one
problem I''ve run into is that it''s very difficult to customize
inherited_resource behaviour in subclasses. Looking through the
source I see it uses things like undef_method and class_attribute.
For example, if I have the following controllers:
class ItemsController
inherit_resources
actions :new,
2009 Oct 13
3
Site map
Hi All...
I am using generate_sitemap plugin to generate sitemap. It goes very
well and creates sitemap as well. My problem is I want some links that
are coming from vender/plugins. Can any one tell me how to get those
links???
Thanks all...
--
Posted via http://www.ruby-forum.com/.
2008 Apr 09
2
sitemap for RoR
Hi all
is there a plugin available by which i can generate a sitemap for my
site automatically.. I mean when ever a page is added it will get listed
in the sitemap?
If you have implemented it do let me know
thanks
dhaval parikh
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
2006 Apr 27
3
Routing problem
Hi,
I am having a routing problem and can''t figure out why its happing. I
have added the following line in my routing.rb file.
map.connect ''name/:id'', :controller => ''controller_name'', :action =>
''action_name''
When I use http://domain.com/controller_name/action_name/id then it
works fine on the local machine using webrick
2009 Jan 03
2
Some questions from a new webgen user
Hi everyone. Sorry if it is not the place to post questions about
webgen. I use webgen5, i know it is not the stable version but i
couldn''t understand how webgen4 worked, it''s easier with webgen5, and
i won''t have to change my pages when it becomes mainstream ;)
I try to build my homepage using webgen, and there are some things i
don''t know how to do (i am sure
2006 Apr 28
0
available: google sitemap for rails project
Hi,
Google Sitemaps (https://www.google.com/webmasters/sitemaps/) is a way
to help Google''s crawler on your website.
I''ve published a little script to generate, from a rails project, a
urllist file usable with the Google sitemap generator.
You drop the script in your RAILS_ROOT/lib directory, edit it to set
the base url, and you''re set. Run it with
ruby script/runner
2007 Sep 18
2
rSpec / Nested Routes / Mocks
I''m having a terrible time trying to test a nested route with rSpec.
I can''t seem to tell rSpec to expect the call @item.user. The
following error message plagues me not matter how I try to fuss with
the mock:
Spec::Mocks::MockExpectationError in ''ItemsController handling POST /
items should redirect to the new course on successful save''
Mock
2006 Oct 24
1
Broken thread Safe connection Management on Mysql (Mysql too many connections errors)
Hi,
There is an issue on socket connection with backgroundrb (rev 47) and
mysql backend: after a certain number of job you reach the mysql
connection limit as socket are never closed and nobody can connect to
mysql anymore till you stop the backgroundrb daemon.
Already reported on:
http://rubyforge.org/pipermail/backgroundrb-devel/2006-July/000066.html,
2007 Nov 16
1
Temporaly silencing the rails log.
Hi! I want to do what subject say. Is there any elegant way to do this:
???
# Silence the log inside the block attached to the method call.
def silence_logger
orig= nil
ObjectSpace.each_object(::Logger) do |logger|
logger.info "-" * 80
logger.info "Quieting the log..."
orig= logger.level
logger.level= ::Logger::FATAL
end
yield
2006 Aug 24
2
Design questions on creating digg.com-like URLs (are they considered RESTful?)
Hi everyone, I''m working on creating a site that functions similar to
digg.com (please no "no more digg clones" remarks please! :) ). One
thing I really like about digg is there URLs are very nice to read and I
would like to emulate that without having a lot of actions spread out
all over my application.
So in my app I have three main resources:
Users, Tags, and Items
2009 May 03
0
HTTP Auth 401 Even on Valid Login
I can''t understand why authenticate_or_request_with_http_basic keeps
failing even though I am entering the correct info.
If I try to access /admin/items/new, I enter the correct info but I
keep getting prompted.
The strange part is that when I cancel out, I get "HTTP Basic: Acce".
Here''s the controllers:
class Admin::BaseController < ApplicationController
2009 Apr 19
1
Cucmber: Mysql::Error: query: not connected: ROLLBACK
Hi,
I ran in trouble with unexpected rollbacks using cucumber 0.3.0.
My feature-file looks like
Scenario: Create Valid Item
Given I start
and the step is
Given /^I start$/ do
get "/items"
end
In my log/test.log I get
SQL (0.2ms) SET NAMES ''utf8''
SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
SQL (0.1ms) BEGIN
Processing ItemsController#index
2009 Jan 14
1
How to create a sitemap.xml?
Hi all,
is there a way one can generate a sitemap.xml for google in Rails? Is it
similar to generating xml.rss? (Rails 2.2.2)
Thank you,
Rollie.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Oct 21
0
Google Sitemap
Does anyone know how to generate a google sitemap for rails? I''m using
Lighttpd as my webserver.
thanks
c
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to