Hello,
I actually have few simple questions which I cannot find a answer for in
the documentation?
1#
In most of the methods in rails I find the parameter options={} which I
don''t know what it can include? Can somebody explain this one to me
please :)
2#
if parent_id.nil?
link_to "Create link", :action => :create
else
link_to "Create link", :action => :create, :id => parent_id
end
Can''t I do this by DRY? I cannot figure out how to add the if in the
link_to so when parent_id is nil it doesn''t throw exception about that.
3#
Why do I recieve exception when I type this while using the act_as_tree
@pages = Page.find( :all, :conditions => ''parent_id IS
NULL'', :include
=> :children)
----------------------
I hope someone can help me through some of them, so I can keep working
on my little project, and thanks in advance for any help :D
//Jamal
--
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 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
-~----------~----~----~----~------~----~------~--~---
#1
I fixed #1 just with, weird it works now.
link_to "Create page", { :action => :create, :id => parent_id }
--
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 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
-~----------~----~----~----~------~----~------~--~---
Jamal Soueidan wrote:> #1 > > I fixed #1 just with, weird it works now. > link_to "Create page", { :action => :create, :id => parent_id }I meant to say #2, sorry :) -- 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 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 jamal, your 2nd problem got solved b''coz, you combined :id and :actions as one object(meaning one parameter to link_to, so second parameter to link to is options, which is a hash like structure, where you can pass all your arguements), if you don''t put those flower brace, it won''t work b''coz it assumes, :action as second argument and :id as third argument(which is html_options, nothing but all the possible html tag attributes like id, name, style, class etc..). And in your 3rd question, can you please show what exception it throws, and what does :include => :children mean. Are you sure, is there any standard argument to find with :children as the value of :include key? On Aug 25, 1:30 am, Jamal Soueidan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Jamal Soueidan wrote: > > #1 > > > I fixed #1 just with, weird it works now. > > link_to "Create page", { :action => :create, :id => parent_id } > > I meant to say #2, sorry :) > -- > Posted viahttp://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 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 -~----------~----~----~----~------~----~------~--~---