Hi
I have a model called navbar. It does not have a view or a controller
defined.
create_table :navbars do |t|
t.string :name
t.string :display_name
t.string :url
t.string :group_by_module
t.boolean :default_link
t.integer :sort_order
And in the model I have written few methods.
class Navbar < ActiveRecord::Base
def all_modules
NavBar.find (:display_name, :url, :conditions => {:name =>
''module_bar''}, :order => ''sort_order'')
end
def associated_quick_links (selected_module)
NavBar.find (:display_name, :url, :default_link, :conditions =>
{:name => ''quick_links_bar'', :group_by_module =>
selected_module}, :order => ''sort_order'')
end
def associated_module (selected_quick_link)
NavBar.find (:group_by_module, :conditions => {:name =>
''quick_links_bar'', :display_name => selected_quick_links})
end
end
QUESTION --- I want to access these methods from views directly. When
I do <%= debug navbar.all_modules %> it fails. It cannot find the
navbar.
Can someone please guide me?
Thanks in advance
Narendra sisodiya
2009-Jun-16 03:54 UTC
Re: Want to directly access MODEL from VIEW. Can;t :(
For accessing model method from view , you can define self methods in model
and than directly access by ModelName.methodName
For example
class Navbar < ActiveRecord::Base
def self.all_modules
Ur stuff
end
end
in view
<% Navbar.all_modules %>
~
N A R E N
On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij
<Ritvij.J-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi
> I have a model called navbar. It does not have a view or a controller
> defined.
>
> create_table :navbars do |t|
> t.string :name
> t.string :display_name
> t.string :url
> t.string :group_by_module
> t.boolean :default_link
> t.integer :sort_order
>
> And in the model I have written few methods.
>
> class Navbar < ActiveRecord::Base
> def all_modules
> NavBar.find (:display_name, :url, :conditions => {:name =>
> ''module_bar''}, :order =>
''sort_order'')
> end
> def associated_quick_links (selected_module)
> NavBar.find (:display_name, :url, :default_link, :conditions =>
> {:name => ''quick_links_bar'', :group_by_module =>
> selected_module}, :order => ''sort_order'')
> end
> def associated_module (selected_quick_link)
> NavBar.find (:group_by_module, :conditions => {:name =>
> ''quick_links_bar'', :display_name =>
selected_quick_links})
> end
> end
>
> QUESTION --- I want to access these methods from views directly. When
> I do <%= debug navbar.all_modules %> it fails. It cannot find the
> navbar.
>
> Can someone please guide me?
> Thanks in advance
> >
>
--~--~---------~--~----~------------~-------~--~----~
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 from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Did what you said.. Now getting error --- "undefined local variable or method `navbar'' for #<ActionView::Base:0x4dfce0c>" On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> For accessing model method from view , you can define self methods in model > and than directly access by ModelName.methodName > > For example > > class Navbar < ActiveRecord::Base > def self.all_modules > Ur stuff > end > > end > > in view > <% Navbar.all_modules %> > > ~ > N A R E N > > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi > > I have a model called navbar. It does not have a view or a controller > > defined. > > > create_table :navbars do |t| > > t.string :name > > t.string :display_name > > t.string :url > > t.string :group_by_module > > t.boolean :default_link > > t.integer :sort_order > > > And in the model I have written few methods. > > > class Navbar < ActiveRecord::Base > > def all_modules > > NavBar.find (:display_name, :url, :conditions => {:name => > > ''module_bar''}, :order => ''sort_order'') > > end > > def associated_quick_links (selected_module) > > NavBar.find (:display_name, :url, :default_link, :conditions => > > {:name => ''quick_links_bar'', :group_by_module => > > selected_module}, :order => ''sort_order'') > > end > > def associated_module (selected_quick_link) > > NavBar.find (:group_by_module, :conditions => {:name => > > ''quick_links_bar'', :display_name => selected_quick_links}) > > end > > end > > > QUESTION --- I want to access these methods from views directly. When > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > navbar. > > > Can someone please guide me? > > Thanks in advance
Narendra sisodiya
2009-Jun-16 05:25 UTC
Re: Want to directly access MODEL from VIEW. Can;t :(
can you tell me what you did exactly ? On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvij.J-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Did what you said.. > Now getting error --- "undefined local variable or method `navbar'' for > #<ActionView::Base:0x4dfce0c>" > > On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > For accessing model method from view , you can define self methods in > model > > and than directly access by ModelName.methodName > > > > For example > > > > class Navbar < ActiveRecord::Base > > def self.all_modules > > Ur stuff > > end > > > > end > > > > in view > > <% Navbar.all_modules %> > > > > ~ > > N A R E N > > > > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi > > > I have a model called navbar. It does not have a view or a controller > > > defined. > > > > > create_table :navbars do |t| > > > t.string :name > > > t.string :display_name > > > t.string :url > > > t.string :group_by_module > > > t.boolean :default_link > > > t.integer :sort_order > > > > > And in the model I have written few methods. > > > > > class Navbar < ActiveRecord::Base > > > def all_modules > > > NavBar.find (:display_name, :url, :conditions => {:name => > > > ''module_bar''}, :order => ''sort_order'') > > > end > > > def associated_quick_links (selected_module) > > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > {:name => ''quick_links_bar'', :group_by_module => > > > selected_module}, :order => ''sort_order'') > > > end > > > def associated_module (selected_quick_link) > > > NavBar.find (:group_by_module, :conditions => {:name => > > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > end > > > end > > > > > QUESTION --- I want to access these methods from views directly. When > > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > navbar. > > > > > Can someone please guide me? > > > Thanks in advance > > >--~--~---------~--~----~------------~-------~--~----~ 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 from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi QUESTION --- I want to access these methods from views directly. When I do <%= debug navbar.all_modules %> it fails. It cannot find the navbar. This will work fine only if you have navbar as an object of your Navbar model, confirm whether you have done the same. As I observe that your method in model does not have anything related to specific object of the class, you can have it as a class method by defining it as self.all_modules. This can be directly used by Navbar.all_modules Note: One should not use model methods in views directly. Use controller objects or helpers for the same. - Nayak On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < naren.sisodiya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> can you tell me what you did exactly ? > > > On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvij.J-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> Did what you said.. >> Now getting error --- "undefined local variable or method `navbar'' for >> #<ActionView::Base:0x4dfce0c>" >> >> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> > For accessing model method from view , you can define self methods in >> model >> > and than directly access by ModelName.methodName >> > >> > For example >> > >> > class Navbar < ActiveRecord::Base >> > def self.all_modules >> > Ur stuff >> > end >> > >> > end >> > >> > in view >> > <% Navbar.all_modules %> >> > >> > ~ >> > N A R E N >> > >> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > >> > > Hi >> > > I have a model called navbar. It does not have a view or a controller >> > > defined. >> > >> > > create_table :navbars do |t| >> > > t.string :name >> > > t.string :display_name >> > > t.string :url >> > > t.string :group_by_module >> > > t.boolean :default_link >> > > t.integer :sort_order >> > >> > > And in the model I have written few methods. >> > >> > > class Navbar < ActiveRecord::Base >> > > def all_modules >> > > NavBar.find (:display_name, :url, :conditions => {:name => >> > > ''module_bar''}, :order => ''sort_order'') >> > > end >> > > def associated_quick_links (selected_module) >> > > NavBar.find (:display_name, :url, :default_link, :conditions => >> > > {:name => ''quick_links_bar'', :group_by_module => >> > > selected_module}, :order => ''sort_order'') >> > > end >> > > def associated_module (selected_quick_link) >> > > NavBar.find (:group_by_module, :conditions => {:name => >> > > ''quick_links_bar'', :display_name => selected_quick_links}) >> > > end >> > > end >> > >> > > QUESTION --- I want to access these methods from views directly. When >> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the >> > > navbar. >> > >> > > Can someone please guide me? >> > > Thanks in advance >> >> > > > >-- - NAYAK --~--~---------~--~----~------------~-------~--~----~ 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 from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Narendra sisodiya
2009-Jun-16 06:04 UTC
Re: Want to directly access MODEL from VIEW. Can;t :(
agree with Nayak, If you didn''t create the object *navbar* than it will through the exception that is in your case. or define static methods like I did and use directly by model name. Avoid direct model''s method calls in view , use helper file or controller as suggested by Nayak. ~N A R E N On Tue, Jun 16, 2009 at 11:08 AM, NAYAK <nayakk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > QUESTION --- I want to access these methods from views directly. When > I do <%= debug navbar.all_modules %> it fails. It cannot find the > navbar. > > This will work fine only if you have navbar as an object of your Navbar > model, confirm whether you have done the same. > As I observe that your method in model does not have anything related to > specific object of the class, you can have it as a class method by defining > it as self.all_modules. This can be directly used by Navbar.all_modules > > Note: One should not use model methods in views directly. Use controller > objects or helpers for the same. > > - Nayak > > > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < > naren.sisodiya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> can you tell me what you did exactly ? >> >> >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvij.J-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> >>> Did what you said.. >>> Now getting error --- "undefined local variable or method `navbar'' for >>> #<ActionView::Base:0x4dfce0c>" >>> >>> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> wrote: >>> > For accessing model method from view , you can define self methods in >>> model >>> > and than directly access by ModelName.methodName >>> > >>> > For example >>> > >>> > class Navbar < ActiveRecord::Base >>> > def self.all_modules >>> > Ur stuff >>> > end >>> > >>> > end >>> > >>> > in view >>> > <% Navbar.all_modules %> >>> > >>> > ~ >>> > N A R E N >>> > >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > >>> > > Hi >>> > > I have a model called navbar. It does not have a view or a controller >>> > > defined. >>> > >>> > > create_table :navbars do |t| >>> > > t.string :name >>> > > t.string :display_name >>> > > t.string :url >>> > > t.string :group_by_module >>> > > t.boolean :default_link >>> > > t.integer :sort_order >>> > >>> > > And in the model I have written few methods. >>> > >>> > > class Navbar < ActiveRecord::Base >>> > > def all_modules >>> > > NavBar.find (:display_name, :url, :conditions => {:name => >>> > > ''module_bar''}, :order => ''sort_order'') >>> > > end >>> > > def associated_quick_links (selected_module) >>> > > NavBar.find (:display_name, :url, :default_link, :conditions => >>> > > {:name => ''quick_links_bar'', :group_by_module => >>> > > selected_module}, :order => ''sort_order'') >>> > > end >>> > > def associated_module (selected_quick_link) >>> > > NavBar.find (:group_by_module, :conditions => {:name => >>> > > ''quick_links_bar'', :display_name => selected_quick_links}) >>> > > end >>> > > end >>> > >>> > > QUESTION --- I want to access these methods from views directly. When >>> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the >>> > > navbar. >>> > >>> > > Can someone please guide me? >>> > > Thanks in advance >>> >>> >> >> >> > > > -- > - NAYAK > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is like a reference table which doesnt need a controller :|
And it is a reftable for what links to display on screen.
This is what I did finally.
class Navbar < ActiveRecord::Base
def self.all_modules
NavBar.find (:display_name, :url, :conditions => {:name =>
''module_bar''}, :order => ''sort_order'')
end
def self.associated_quick_links (selected_module)
NavBar.find (:display_name, :url, :default_link, :conditions =>
{:name => ''quick_links_bar'', :group_by_module =>
selected_module}, :order => ''sort_order'')
end
def self.associated_module (selected_quick_link)
NavBar.find (:group_by_module, :conditions => {:name =>
''quick_links_bar'', :display_name => selected_quick_links})
end
end
And I am still getting
undefined local variable or method `navbar'' for #<ActionView::Base:
0x4be1140>
Extracted source (around line #2):
1: <div id="content">
2: <%= debug navbar.all_modules %>
Please help
On Jun 16, 1:04 am, Narendra sisodiya
<naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> agree with Nayak,
>
> If you didn''t create the object *navbar* than it will through the
exception
> that is in your case.
>
> or define static methods like I did and use directly by model name.
>
> Avoid direct model''s method calls in view , use helper file or
controller as
> suggested by Nayak.
>
> ~N A R E N
>
> On Tue, Jun 16, 2009 at 11:08 AM, NAYAK
<nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Hi
>
> > QUESTION --- I want to access these methods from views directly. When
> > I do <%= debug navbar.all_modules %> it fails. It cannot find
the
> > navbar.
>
> > This will work fine only if you have navbar as an object of your
Navbar
> > model, confirm whether you have done the same.
> > As I observe that your method in model does not have anything related
to
> > specific object of the class, you can have it as a class method by
defining
> > it as self.all_modules. This can be directly used by
Navbar.all_modules
>
> > Note: One should not use model methods in views directly. Use
controller
> > objects or helpers for the same.
>
> > - Nayak
>
> > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya <
> > naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> >> can you tell me what you did exactly ?
>
> >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij
<Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> >>> Did what you said..
> >>> Now getting error --- "undefined local variable or method
`navbar'' for
> >>> #<ActionView::Base:0x4dfce0c>"
>
> >>> On Jun 15, 10:54 pm, Narendra sisodiya
<naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >>> wrote:
> >>> > For accessing model method from view , you can define
self methods in
> >>> model
> >>> > and than directly access by ModelName.methodName
>
> >>> > For example
>
> >>> > class Navbar < ActiveRecord::Base
> >>> > def self.all_modules
> >>> > Ur stuff
> >>> > end
>
> >>> > end
>
> >>> > in view
> >>> > <% Navbar.all_modules %>
>
> >>> > ~
> >>> > N A R E N
>
> >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij
<Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> >>> > > Hi
> >>> > > I have a model called navbar. It does not have a
view or a controller
> >>> > > defined.
>
> >>> > > create_table :navbars do |t|
> >>> > > t.string :name
> >>> > > t.string :display_name
> >>> > > t.string :url
> >>> > > t.string :group_by_module
> >>> > > t.boolean :default_link
> >>> > > t.integer :sort_order
>
> >>> > > And in the model I have written few methods.
>
> >>> > > class Navbar < ActiveRecord::Base
> >>> > > def all_modules
> >>> > > NavBar.find (:display_name, :url, :conditions =>
{:name =>
> >>> > > ''module_bar''}, :order =>
''sort_order'')
> >>> > > end
> >>> > > def associated_quick_links (selected_module)
> >>> > > NavBar.find (:display_name, :url, :default_link,
:conditions =>
> >>> > > {:name => ''quick_links_bar'',
:group_by_module =>
> >>> > > selected_module}, :order =>
''sort_order'')
> >>> > > end
> >>> > > def associated_module (selected_quick_link)
> >>> > > NavBar.find (:group_by_module, :conditions =>
{:name =>
> >>> > > ''quick_links_bar'', :display_name
=> selected_quick_links})
> >>> > > end
> >>> > > end
>
> >>> > > QUESTION --- I want to access these methods from
views directly. When
> >>> > > I do <%= debug navbar.all_modules %> it fails.
It cannot find the
> >>> > > navbar.
>
> >>> > > Can someone please guide me?
> >>> > > Thanks in advance
>
> > --
> > - NAYAK
Narendra sisodiya
2009-Jun-16 10:44 UTC
Re: Want to directly access MODEL from VIEW. Can;t :(
ok let me explain you in your code following is your code 1: <div id="content"> 2: <%= debug navbar.all_modules %> now the navbar is undefined , please replace navbar to *Navbar* capital *N*that is your Model name see in this line class *Navbar *< ActiveRecord::Base now try this and let me know ~N A R E N On Tue, Jun 16, 2009 at 4:04 PM, Ritvvij <Ritvij.J-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > This is like a reference table which doesnt need a controller :| > And it is a reftable for what links to display on screen. > > This is what I did finally. > > class Navbar < ActiveRecord::Base > def self.all_modules > NavBar.find (:display_name, :url, :conditions => {:name => > ''module_bar''}, :order => ''sort_order'') > end > def self.associated_quick_links (selected_module) > NavBar.find (:display_name, :url, :default_link, :conditions => > {:name => ''quick_links_bar'', :group_by_module => > selected_module}, :order => ''sort_order'') > end > def self.associated_module (selected_quick_link) > NavBar.find (:group_by_module, :conditions => {:name => > ''quick_links_bar'', :display_name => selected_quick_links}) > end > end > > And I am still getting > undefined local variable or method `navbar'' for #<ActionView::Base: > 0x4be1140> > Extracted source (around line #2): > 1: <div id="content"> > 2: <%= debug navbar.all_modules %> > > Please help > > > On Jun 16, 1:04 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > agree with Nayak, > > > > If you didn''t create the object *navbar* than it will through the > exception > > that is in your case. > > > > or define static methods like I did and use directly by model name. > > > > Avoid direct model''s method calls in view , use helper file or controller > as > > suggested by Nayak. > > > > ~N A R E N > > > > On Tue, Jun 16, 2009 at 11:08 AM, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi > > > > > QUESTION --- I want to access these methods from views directly. When > > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > navbar. > > > > > This will work fine only if you have navbar as an object of your Navbar > > > model, confirm whether you have done the same. > > > As I observe that your method in model does not have anything related > to > > > specific object of the class, you can have it as a class method by > defining > > > it as self.all_modules. This can be directly used by Navbar.all_modules > > > > > Note: One should not use model methods in views directly. Use > controller > > > objects or helpers for the same. > > > > > - Nayak > > > > > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < > > > naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >> can you tell me what you did exactly ? > > > > >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >>> Did what you said.. > > >>> Now getting error --- "undefined local variable or method `navbar'' > for > > >>> #<ActionView::Base:0x4dfce0c>" > > > > >>> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > >>> wrote: > > >>> > For accessing model method from view , you can define self methods > in > > >>> model > > >>> > and than directly access by ModelName.methodName > > > > >>> > For example > > > > >>> > class Navbar < ActiveRecord::Base > > >>> > def self.all_modules > > >>> > Ur stuff > > >>> > end > > > > >>> > end > > > > >>> > in view > > >>> > <% Navbar.all_modules %> > > > > >>> > ~ > > >>> > N A R E N > > > > >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > >>> > > Hi > > >>> > > I have a model called navbar. It does not have a view or a > controller > > >>> > > defined. > > > > >>> > > create_table :navbars do |t| > > >>> > > t.string :name > > >>> > > t.string :display_name > > >>> > > t.string :url > > >>> > > t.string :group_by_module > > >>> > > t.boolean :default_link > > >>> > > t.integer :sort_order > > > > >>> > > And in the model I have written few methods. > > > > >>> > > class Navbar < ActiveRecord::Base > > >>> > > def all_modules > > >>> > > NavBar.find (:display_name, :url, :conditions => {:name => > > >>> > > ''module_bar''}, :order => ''sort_order'') > > >>> > > end > > >>> > > def associated_quick_links (selected_module) > > >>> > > NavBar.find (:display_name, :url, :default_link, :conditions => > > >>> > > {:name => ''quick_links_bar'', :group_by_module => > > >>> > > selected_module}, :order => ''sort_order'') > > >>> > > end > > >>> > > def associated_module (selected_quick_link) > > >>> > > NavBar.find (:group_by_module, :conditions => {:name => > > >>> > > ''quick_links_bar'', :display_name => selected_quick_links}) > > >>> > > end > > >>> > > end > > > > >>> > > QUESTION --- I want to access these methods from views directly. > When > > >>> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > >>> > > navbar. > > > > >>> > > Can someone please guide me? > > >>> > > Thanks in advance > > > > > -- > > > - NAYAK > > >--~--~---------~--~----~------------~-------~--~----~ 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 from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<div id="content"> <%= debug NavBar.all_modules %> Now it gives uninitialized constant ActionView::Base::CompiledTemplates::NavBar Extracted source (around line #2): 1: <div id="content"> 2: <%= debug NavBar.all_modules %> On Jun 16, 5:44 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok let me explain you in your code > > following is your code > > 1: <div id="content"> > 2: <%= debug navbar.all_modules %> > > now the navbar is undefined , please replace navbar to *Navbar* > capital *N*that is your Model name > > see in this line > class *Navbar *< ActiveRecord::Base > > now try this and let me know > > ~N A R E N > > On Tue, Jun 16, 2009 at 4:04 PM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > This is like a reference table which doesnt need a controller :| > > And it is a reftable for what links to display on screen. > > > This is what I did finally. > > > class Navbar < ActiveRecord::Base > > def self.all_modules > > NavBar.find (:display_name, :url, :conditions => {:name => > > ''module_bar''}, :order => ''sort_order'') > > end > > def self.associated_quick_links (selected_module) > > NavBar.find (:display_name, :url, :default_link, :conditions => > > {:name => ''quick_links_bar'', :group_by_module => > > selected_module}, :order => ''sort_order'') > > end > > def self.associated_module (selected_quick_link) > > NavBar.find (:group_by_module, :conditions => {:name => > > ''quick_links_bar'', :display_name => selected_quick_links}) > > end > > end > > > And I am still getting > > undefined local variable or method `navbar'' for #<ActionView::Base: > > 0x4be1140> > > Extracted source (around line #2): > > 1: <div id="content"> > > 2: <%= debug navbar.all_modules %> > > > Please help > > > On Jun 16, 1:04 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > agree with Nayak, > > > > If you didn''t create the object *navbar* than it will through the > > exception > > > that is in your case. > > > > or define static methods like I did and use directly by model name. > > > > Avoid direct model''s method calls in view , use helper file or controller > > as > > > suggested by Nayak. > > > > ~N A R E N > > > > On Tue, Jun 16, 2009 at 11:08 AM, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi > > > > > QUESTION --- I want to access these methods from views directly. When > > > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > > navbar. > > > > > This will work fine only if you have navbar as an object of your Navbar > > > > model, confirm whether you have done the same. > > > > As I observe that your method in model does not have anything related > > to > > > > specific object of the class, you can have it as a class method by > > defining > > > > it as self.all_modules. This can be directly used by Navbar.all_modules > > > > > Note: One should not use model methods in views directly. Use > > controller > > > > objects or helpers for the same. > > > > > - Nayak > > > > > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < > > > > naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >> can you tell me what you did exactly ? > > > > >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >>> Did what you said.. > > > >>> Now getting error --- "undefined local variable or method `navbar'' > > for > > > >>> #<ActionView::Base:0x4dfce0c>" > > > > >>> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > >>> wrote: > > > >>> > For accessing model method from view , you can define self methods > > in > > > >>> model > > > >>> > and than directly access by ModelName.methodName > > > > >>> > For example > > > > >>> > class Navbar < ActiveRecord::Base > > > >>> > def self.all_modules > > > >>> > Ur stuff > > > >>> > end > > > > >>> > end > > > > >>> > in view > > > >>> > <% Navbar.all_modules %> > > > > >>> > ~ > > > >>> > N A R E N > > > > >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > >>> > > Hi > > > >>> > > I have a model called navbar. It does not have a view or a > > controller > > > >>> > > defined. > > > > >>> > > create_table :navbars do |t| > > > >>> > > t.string :name > > > >>> > > t.string :display_name > > > >>> > > t.string :url > > > >>> > > t.string :group_by_module > > > >>> > > t.boolean :default_link > > > >>> > > t.integer :sort_order > > > > >>> > > And in the model I have written few methods. > > > > >>> > > class Navbar < ActiveRecord::Base > > > >>> > > def all_modules > > > >>> > > NavBar.find (:display_name, :url, :conditions => {:name => > > > >>> > > ''module_bar''}, :order => ''sort_order'') > > > >>> > > end > > > >>> > > def associated_quick_links (selected_module) > > > >>> > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > >>> > > {:name => ''quick_links_bar'', :group_by_module => > > > >>> > > selected_module}, :order => ''sort_order'') > > > >>> > > end > > > >>> > > def associated_module (selected_quick_link) > > > >>> > > NavBar.find (:group_by_module, :conditions => {:name => > > > >>> > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > >>> > > end > > > >>> > > end > > > > >>> > > QUESTION --- I want to access these methods from views directly. > > When > > > >>> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > >>> > > navbar. > > > > >>> > > Can someone please guide me? > > > >>> > > Thanks in advance > > > > > -- > > > > - NAYAK
Frederick Cheung
2009-Jun-16 11:39 UTC
Re: Want to directly access MODEL from VIEW. Can;t :(
On Jun 16, 12:16 pm, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <div id="content"> > <%= debug NavBar.all_modules %>According to your previous posts the class is called Navbar, so you need to type exactly that. Not navbar, NavBar, NAvBaR or anything like that. Fred> > Now it gives > > uninitialized constant ActionView::Base::CompiledTemplates::NavBar > Extracted source (around line #2): > 1: <div id="content"> > 2: <%= debug NavBar.all_modules %> > > On Jun 16, 5:44 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > ok let me explain you in your code > > > following is your code > > > 1: <div id="content"> > > 2: <%= debug navbar.all_modules %> > > > now the navbar is undefined , please replace navbar to *Navbar* > > capital *N*that is your Model name > > > see in this line > > class *Navbar *< ActiveRecord::Base > > > now try this and let me know > > > ~N A R E N > > > On Tue, Jun 16, 2009 at 4:04 PM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > This is like a reference table which doesnt need a controller :| > > > And it is a reftable for what links to display on screen. > > > > This is what I did finally. > > > > class Navbar < ActiveRecord::Base > > > def self.all_modules > > > NavBar.find (:display_name, :url, :conditions => {:name => > > > ''module_bar''}, :order => ''sort_order'') > > > end > > > def self.associated_quick_links (selected_module) > > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > {:name => ''quick_links_bar'', :group_by_module => > > > selected_module}, :order => ''sort_order'') > > > end > > > def self.associated_module (selected_quick_link) > > > NavBar.find (:group_by_module, :conditions => {:name => > > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > end > > > end > > > > And I am still getting > > > undefined local variable or method `navbar'' for #<ActionView::Base: > > > 0x4be1140> > > > Extracted source (around line #2): > > > 1: <div id="content"> > > > 2: <%= debug navbar.all_modules %> > > > > Please help > > > > On Jun 16, 1:04 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > agree with Nayak, > > > > > If you didn''t create the object *navbar* than it will through the > > > exception > > > > that is in your case. > > > > > or define static methods like I did and use directly by model name. > > > > > Avoid direct model''s method calls in view , use helper file or controller > > > as > > > > suggested by Nayak. > > > > > ~N A R E N > > > > > On Tue, Jun 16, 2009 at 11:08 AM, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi > > > > > > QUESTION --- I want to access these methods from views directly. When > > > > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > > > navbar. > > > > > > This will work fine only if you have navbar as an object of your Navbar > > > > > model, confirm whether you have done the same. > > > > > As I observe that your method in model does not have anything related > > > to > > > > > specific object of the class, you can have it as a class method by > > > defining > > > > > it as self.all_modules. This can be directly used by Navbar.all_modules > > > > > > Note: One should not use model methods in views directly. Use > > > controller > > > > > objects or helpers for the same. > > > > > > - Nayak > > > > > > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < > > > > > naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > >> can you tell me what you did exactly ? > > > > > >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > >>> Did what you said.. > > > > >>> Now getting error --- "undefined local variable or method `navbar'' > > > for > > > > >>> #<ActionView::Base:0x4dfce0c>" > > > > > >>> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8@public.gmane.orgm> > > > > >>> wrote: > > > > >>> > For accessing model method from view , you can define self methods > > > in > > > > >>> model > > > > >>> > and than directly access by ModelName.methodName > > > > > >>> > For example > > > > > >>> > class Navbar < ActiveRecord::Base > > > > >>> > def self.all_modules > > > > >>> > Ur stuff > > > > >>> > end > > > > > >>> > end > > > > > >>> > in view > > > > >>> > <% Navbar.all_modules %> > > > > > >>> > ~ > > > > >>> > N A R E N > > > > > >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > >>> > > Hi > > > > >>> > > I have a model called navbar. It does not have a view or a > > > controller > > > > >>> > > defined. > > > > > >>> > > create_table :navbars do |t| > > > > >>> > > t.string :name > > > > >>> > > t.string :display_name > > > > >>> > > t.string :url > > > > >>> > > t.string :group_by_module > > > > >>> > > t.boolean :default_link > > > > >>> > > t.integer :sort_order > > > > > >>> > > And in the model I have written few methods. > > > > > >>> > > class Navbar < ActiveRecord::Base > > > > >>> > > def all_modules > > > > >>> > > NavBar.find (:display_name, :url, :conditions => {:name => > > > > >>> > > ''module_bar''}, :order => ''sort_order'') > > > > >>> > > end > > > > >>> > > def associated_quick_links (selected_module) > > > > >>> > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > > >>> > > {:name => ''quick_links_bar'', :group_by_module => > > > > >>> > > selected_module}, :order => ''sort_order'') > > > > >>> > > end > > > > >>> > > def associated_module (selected_quick_link) > > > > >>> > > NavBar.find (:group_by_module, :conditions => {:name => > > > > >>> > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > > >>> > > end > > > > >>> > > end > > > > > >>> > > QUESTION --- I want to access these methods from views directly. > > > When > > > > >>> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > > >>> > > navbar. > > > > > >>> > > Can someone please guide me? > > > > >>> > > Thanks in advance > > > > > > -- > > > > > - NAYAK
In the controller for the action you are testing, did you create an instance of your Navbar class? You are defining a Navbar class, but a class without an instance is fairly useless... Something like: @navbar = Navbar.new If so, then the view code as you had it: <%= @navbar.all_modules %> should have an instance of Navbar to work with. Your all_modules method inside Navbar cons a little dubious though... -- Posted via http://www.ruby-forum.com/.
Well.. I am using it in application.html.erb --> layouts. So where should I create the instance? On Jun 16, 6:43 am, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> In the controller for the action you are testing, did you create an > instance of your Navbar class? You are defining a Navbar class, but a > class without an instance is fairly useless... Something like: > > @navbar = Navbar.new > > If so, then the view code as you had it: > > <%= @navbar.all_modules %> > > should have an instance of Navbar to work with. Your all_modules method > inside Navbar cons a little dubious though... > -- > Posted viahttp://www.ruby-forum.com/.
NavBar is a reference table whose content needs to be accessed in all VIEWS. This includes the application layout too. Can you please guide which is the best way to model this??? + where to initialize an instance? On Jun 16, 7:43 am, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well.. I am using it in application.html.erb --> layouts. > So where should I create the instance? > > On Jun 16, 6:43 am, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > In the controller for the action you are testing, did you create an > > instance of your Navbar class? You are defining a Navbar class, but a > > class without an instance is fairly useless... Something like: > > > @navbar = Navbar.new > > > If so, then the view code as you had it: > > > <%= @navbar.all_modules %> > > > should have an instance of Navbar to work with. Your all_modules method > > inside Navbar cons a little dubious though... > > -- > > Posted viahttp://www.ruby-forum.com/.
If you want to initialise the Navbar instance somewhere that has to be
accessed by all views (or the layout), put it in the application
controller as a before_filter. For example:
class ApplicationController < ActionController::Base
# Some other stuff
before_filter :get_navbar
def get_navbar
@navbar = Navbar.new
end
# More stuff
end
Then in you view or layout you can access methods using the syntax as
outlined earlier:
<%= @navbar.all_modules %>
On Jun 16, 7:05 am, Ritvvij
<Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> NavBar is a reference table whose content needs to be accessed in all
> VIEWS.
> This includes the application layout too.
> Can you please guide which is the best way to model this??? + where to
> initialize an instance?
>
> On Jun 16, 7:43 am, Ritvvij
<Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Well.. I am using it in application.html.erb --> layouts.
> > So where should I create the instance?
>
> > On Jun 16, 6:43 am, Ar Chron
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> > > In the controller for the action you are testing, did you create
an
> > > instance of your Navbar class? You are defining a Navbar class,
but a
> > > class without an instance is fairly useless... Something like:
>
> > > @navbar = Navbar.new
>
> > > If so, then the view code as you had it:
>
> > > <%= @navbar.all_modules %>
>
> > > should have an instance of Navbar to work with. Your all_modules
method
> > > inside Navbar cons a little dubious though...
> > > --
> > > Posted viahttp://www.ruby-forum.com/.
>
>
Have you tried it this way yet??? (capital N only!) <%= debug Navbar.all_modules %> On Jun 16, 4:16 am, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <div id="content"> > <%= debug NavBar.all_modules %> > > Now it gives > > uninitialized constant ActionView::Base::CompiledTemplates::NavBar > Extracted source (around line #2): > 1: <div id="content"> > 2: <%= debug NavBar.all_modules %> > > On Jun 16, 5:44 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > ok let me explain you in your code > > > following is your code > > > 1: <div id="content"> > > 2: <%= debug navbar.all_modules %> > > > now the navbar is undefined , please replace navbar to *Navbar* > > capital *N*that is your Model name > > > see in this line > > class *Navbar *< ActiveRecord::Base > > > now try this and let me know > > > ~N A R E N > > > On Tue, Jun 16, 2009 at 4:04 PM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > This is like a reference table which doesnt need a controller :| > > > And it is a reftable for what links to display on screen. > > > > This is what I did finally. > > > > class Navbar < ActiveRecord::Base > > > def self.all_modules > > > NavBar.find (:display_name, :url, :conditions => {:name => > > > ''module_bar''}, :order => ''sort_order'') > > > end > > > def self.associated_quick_links (selected_module) > > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > {:name => ''quick_links_bar'', :group_by_module => > > > selected_module}, :order => ''sort_order'') > > > end > > > def self.associated_module (selected_quick_link) > > > NavBar.find (:group_by_module, :conditions => {:name => > > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > end > > > end > > > > And I am still getting > > > undefined local variable or method `navbar'' for #<ActionView::Base: > > > 0x4be1140> > > > Extracted source (around line #2): > > > 1: <div id="content"> > > > 2: <%= debug navbar.all_modules %> > > > > Please help > > > > On Jun 16, 1:04 am, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > agree with Nayak, > > > > > If you didn''t create the object *navbar* than it will through the > > > exception > > > > that is in your case. > > > > > or define static methods like I did and use directly by model name. > > > > > Avoid direct model''s method calls in view , use helper file or controller > > > as > > > > suggested by Nayak. > > > > > ~N A R E N > > > > > On Tue, Jun 16, 2009 at 11:08 AM, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi > > > > > > QUESTION --- I want to access these methods from views directly. When > > > > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > > > navbar. > > > > > > This will work fine only if you have navbar as an object of your Navbar > > > > > model, confirm whether you have done the same. > > > > > As I observe that your method in model does not have anything related > > > to > > > > > specific object of the class, you can have it as a class method by > > > defining > > > > > it as self.all_modules. This can be directly used by Navbar.all_modules > > > > > > Note: One should not use model methods in views directly. Use > > > controller > > > > > objects or helpers for the same. > > > > > > - Nayak > > > > > > On Tue, Jun 16, 2009 at 10:55 AM, Narendra sisodiya < > > > > > naren.sisod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > >> can you tell me what you did exactly ? > > > > > >> On Tue, Jun 16, 2009 at 9:43 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > >>> Did what you said.. > > > > >>> Now getting error --- "undefined local variable or method `navbar'' > > > for > > > > >>> #<ActionView::Base:0x4dfce0c>" > > > > > >>> On Jun 15, 10:54 pm, Narendra sisodiya <naren.sisod...-Re5JQEeQqe8@public.gmane.orgm> > > > > >>> wrote: > > > > >>> > For accessing model method from view , you can define self methods > > > in > > > > >>> model > > > > >>> > and than directly access by ModelName.methodName > > > > > >>> > For example > > > > > >>> > class Navbar < ActiveRecord::Base > > > > >>> > def self.all_modules > > > > >>> > Ur stuff > > > > >>> > end > > > > > >>> > end > > > > > >>> > in view > > > > >>> > <% Navbar.all_modules %> > > > > > >>> > ~ > > > > >>> > N A R E N > > > > > >>> > On Tue, Jun 16, 2009 at 9:02 AM, Ritvvij <Ritvi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > >>> > > Hi > > > > >>> > > I have a model called navbar. It does not have a view or a > > > controller > > > > >>> > > defined. > > > > > >>> > > create_table :navbars do |t| > > > > >>> > > t.string :name > > > > >>> > > t.string :display_name > > > > >>> > > t.string :url > > > > >>> > > t.string :group_by_module > > > > >>> > > t.boolean :default_link > > > > >>> > > t.integer :sort_order > > > > > >>> > > And in the model I have written few methods. > > > > > >>> > > class Navbar < ActiveRecord::Base > > > > >>> > > def all_modules > > > > >>> > > NavBar.find (:display_name, :url, :conditions => {:name => > > > > >>> > > ''module_bar''}, :order => ''sort_order'') > > > > >>> > > end > > > > >>> > > def associated_quick_links (selected_module) > > > > >>> > > NavBar.find (:display_name, :url, :default_link, :conditions => > > > > >>> > > {:name => ''quick_links_bar'', :group_by_module => > > > > >>> > > selected_module}, :order => ''sort_order'') > > > > >>> > > end > > > > >>> > > def associated_module (selected_quick_link) > > > > >>> > > NavBar.find (:group_by_module, :conditions => {:name => > > > > >>> > > ''quick_links_bar'', :display_name => selected_quick_links}) > > > > >>> > > end > > > > >>> > > end > > > > > >>> > > QUESTION --- I want to access these methods from views directly. > > > When > > > > >>> > > I do <%= debug navbar.all_modules %> it fails. It cannot find the > > > > >>> > > navbar. > > > > > >>> > > Can someone please guide me? > > > > >>> > > Thanks in advance > > > > > > -- > > > > > - NAYAK