similar to: instance_eval and Proc objects

Displaying 20 results from an estimated 6000 matches similar to: "instance_eval and Proc objects"

2006 Jun 09
11
Adding routes from plugin
Can anyone tell me how to add routes from plugin? I know it is possible because of this changeset: http://dev.rubyonrails.org/changeset/2967 but i didn''t find way how to do it. retro -- Posted via http://www.ruby-forum.com/.
2006 May 18
4
Request Routing Plugin ( :requirements => { :subdomain => ''thing'' } finally works)
Hi All, Just a quick note to say that I''ve released an intial version of the request routing plugin which essentially allows you to use various request object properties as requirements in routes. Most notably you can do: map.connect "thing", :controller => ''main'', :requirements => { :subdomain => ''whatever'' } ..just like the wiki
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
I''m trying to add some per-object behaviors to objects descended from ActiveRecord, by using after_initialize() and instance_eval(), like this: def after_initialize self.instance_eval(File.read(''customers/default.rb'')) end (Ultimately the file path will be dynamic, this is just proof of concept.) default.rb just contains a few method definitions like this one: def
2006 Jul 21
3
Unobtrusive Javascript plugin
Hi, I downloaded the unobtrusive_javascript pluing from this link (http://www.lukeredpath.co.uk/index.php/2006/06/06/introducing-unobtrusive-javascript-for-rails/) since I needed to have dynamic content in javascript (for a pop-up menu). Unfortunately I have been unable to make the plugin work. I followed the instructions on the website, but for some reason the javascript doesn?t work (for
2006 Mar 26
9
validate_uniqueness_of {combination of fields} ???
I''ve looked at the validates documentation and it appears that validates_uniqueness_of works on only one field at a time. So I can, for example, validate that "sam" is unique to the record set, and that "smith" is unique to the record set. My problem is that each record includes two fields, the _combination_ of which must be unique to the record set, but each of
2006 Feb 10
7
convert rails object to javascript variables
Am i a total idiot to try and parse out a rails object for javascript in this way? <% for i in interface_items[0].attributes %> var <%= i[0] %> = "<%=h( i[1] )%>" <% end %> Am I missing something really obvious? Thanks, Mark -- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.
2007 Aug 08
5
and_yield + instance_eval(&block)
I have the following code, which yields instance eval''s the block given: class Foo def bar(&blk) instance_eval &blk end def baz yield end end The effect of this is that self is reassigned: Foo.new.bar do # here, self is the instance of Foo # created by new end But normally self is the object in which Foo.new.bar {...} occurs. Foo.new.baz do
2006 Jan 12
3
Introspecting Active Record Associations
Hi, I''m looking into write scaffold generators that will, amoung other things, scaffold active record associations (eg. generate select boxes for belongs_to where you can choose a parent object) for quicker prototyping. But... My question is: Is there anyway of finding out what associations exist from examining the lodel classes themselves or indeed any other way of finding out this
2005 Nov 28
5
Rails on lighttpd through proxy
Hi All, We have a PHP site running on apache 1.3 and Im trying to graft typo onto it at /blog/. Ive got the running using the symlink method but apache/fastcgi are clunky to say the least so I want to move typo over to lighttpd. Ive got this all working and Im now trying to get a proxy working through from apache. Im using this: RewriteRule ^/blog/?(.*)$ http://blog.myorg.net:8080/$1 [P]
2006 May 12
7
RJS and page.select collection size
I need to implement a conditional in my RJS template which looks something like: if (page.select(''row1'').first != null) page << "new TableRow.MoveAfter(''row1'', ''newrow'');" else page << "new TableRow.MoveAfter(''row2'', ''newrow'');" end Now, dumb question.. My
2006 Feb 10
1
Rails is the devil on your client-side shoulder
Hi Everyone, Sorry for the inflamatory title, just trying to get your attention. Ive been thinking alot about the JavaScript helpers and I''ve written my thoughts on my companies blog if any of you are interested: http://www.vivabit.com/bollocks/2006/02/09/rails-is-the-devil-in-your-client-side-shoulder I know people have brought this up a number of times but I really think it needs
2006 Jul 24
3
Rails and Dojo
Anyone have any positive or negative experiences trying to get Dojo to play nicely with Rails / Prototype / Scriptaculous? Would people recommend it? Recommend against it? Why? Thanks, Brad
2006 Mar 23
10
Domain Requirements in Routes (Edge Rails)
I saw on the bottom of the following page that you can route requests to different controllers based upon which subdomain is being requested. http://wiki.rubyonrails.com/rails/pages/Routes with_options :requirements=>{:subdomain=>''first.com''} do map.connect '''', :controller => "first/catalog" map.connect ''featured'',
2006 Mar 19
38
Macbook for Rails Development
Hi All, I''ve finally got fed up of struggling with Windows and am on the verge of splashing out on a Macbook for Ruby/Rails development. I''ve seen DHH''s post about it on loudthinking but I wondered if anyone else has any more wisdom... Is it worth it over a powerbook? Any tips on good OSX apps for Rails dev (textmate, i know already)? Anything not working well on
2007 Dec 06
3
anybody use OPEN_ID to authenticate?
how did it go? here is the link if you are interested: http://openid.net/what/ -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe
2006 Mar 05
7
whatever happend to unobtrusive javascript in Rails ?
Don''t get me wrong, JavaScript/Ajax helpers in Rails are a huge timesaver and they have helped me to finally overcome my irrational aversion to js libraries like prototype and such. However, all this goodness seems to come at quiet a price. The resulting code is littered with inline JS, including ubiquitous script tags and onload attributes etc.. It seems that just when i found
2006 Jul 28
4
Validation Reflection plugin
The validation reflection plugin adds three things (1) Reflective access to validations - ModelClass.reflect_on_all_validations - ModelClass.reflect_on_validations_for(:property) (2) It provides "declarative" methods for defining validations based on database metadata - validates_presence_of_mandatory_content_columns - validates_lengths_of_string_attributes -
2006 Jul 27
9
Introspecting validates_presence_of
Hello people, I''d like to detect whether an attribute of a model has vaildates_presence_of applied to it so I can automatically apply a mandatory (*) to the field...it doesn''t look easy...any ideas? Cheers, -- Dan Webb http://www.danwebb.net
2006 Jun 27
3
Weird ActiveRecord Foreign Key Problem
Hello to all, I ran into a weird problem with an ActivRecord. I have a table named "build_order" with a column named "type" that is a foreign key to a table called "building_type". In a controller I try to read all the build_orders with "BuildOrder.find :all" and get the following error and stack trace: (eval):1:in `instance_eval'': compile
2006 Mar 25
1
routes mapping, subdomains and page-caching
Each of its own is no problem, but the combination of them is confusing my head ! I want to to map in routes.rb an url for an article which is identified by its permalink. The permalink is unique per subdomain. Has anybody done that and can post an example ? Should I do subdomain filtering in routes.rb so I can get page-cachabled URLs (and URL rewriting in Lighttpd form subdomain-urls to