Search Results

Search found 8 results on 1 pages for 'sameera207'.

Page 1/1 | 1 

  • what is the best to use - ruby gems or ruby plugins

    - by sameera207
    Hi All, What is the best practice when creating a rails project 1 - is it good to use ruby gems 2 - or is it good to use ruby plugins (as almost all the gems has their plugin versions) and what are the strengths and weaknesses of eachoption consider we are creating the rails project with rails 2.x.x or rails 3 thanks in advance cheers, sameera

    Read the article

  • rails - named scoped help

    - by sameera207
    Hi All, I want to write a named scoped to get a record from its id. Ex: I have a model called Event and its same as doing Event.find(id) (I dont want to use find inside my controller and I want my controller to use a named scoped (for future flexibility)) So I have written a named scoped named_scope :from_id, lambda { |id| {:conditions = ['id= ?', id] } } and I'm calling it from my controller like Event.from_id(id) But my problems is it returns Event object array not only one object Ex: if I want to get event name I have to write event = Event.from_id(id) event[0].name instead I want to write event = Event.from_id(id) event.name Am I doing something wrong here.. thanks in advance cheers sameera

    Read the article

  • ruby hash problem

    - by sameera207
    HI All I have the following hash {:charge_payable_response={:return="700", :ns2="http://ws.myws.com/"}} How can i get the value of the key :return (700) thanks in advance cheers sameera

    Read the article

  • RegEx to exclude a string

    - by sameera207
    Hi All, I have the following strings in my application. /admin/stylesheets/11 /admin/javascripts/11 /contactus what I want to do is to write a regular expression to capture anything other than string starting with 'admin' basically my regex should capture only /contactus by excluding both /admin/stylesheets/11 /admin/javascripts/11 to capture all i wrote /.+/ and i wrote /(admin).+/ which captures everything starts with 'admin'. how can i do the reverse. I mean get everything not starting with 'admin' thanks in advance cheers sameera

    Read the article

  • How can I make named_scope in Rails return one value instead of an array?

    - by sameera207
    I want to write a [named scope] to get a record from its id. For example, I have a model called Event, and I want to simulate Event.find(id) with use of named_scope for future flexibility. I used this code in my model: named_scope :from_id, lambda { |id| {:conditions => ['id= ?', id] } } and I call it from my controller like Event.from_id(id). But my problem is that it returns an array of Event objects instead of just one object. Thus if I want to get event name, I have to write event = Event.from_id(id) event[0].name while what I want is event = Event.from_id(id) event.name Am I doing something wrong here?

    Read the article

1