I''m trying to use a partial from within Markaby. I haven''t
been able to
figure out how to access a parameter passed into the partial. Here''s
the
code I''m using:
h1 "Create a new note"
if @note
render :partial => ''form/errors'', :record => @note
end
...
(that snippet, as well as the partial is stolen shamelessly from Restolog
(thought converted to Markaby), which is a nice example of a REST-ful rails
app)
here''s the partial, in form/_errors.mab:
unless record.nil? or record.errors.empty?
div :class => "message-error" do
p "The #{record.class.to_s.downcase} could not be saved:"
ul do
record.errors.full_messages.each do |m|
li m.gsub(/ id /, '' '')
end
end
end
end
The error I get is this:
notes/vendor/plugins/markaby/lib/markaby/builder.rb:203:in
`method_missing'': no such method `record''
Anyone know what I''m missing here? I suspect that there''s a
special way to
access parameters in partials for Markaby, but I haven''t been able to
figure
out what it is.
--
Larry Wright
http://www.approachingnormal.com
http://www.welcometoparenthood.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
-~----------~----~----~----~------~----~------~--~---
Try putting parens around everything after "render" On Sep 10, 2006, at 10:33 AM, Larry Wright wrote:> I''m trying to use a partial from within Markaby. I haven''t been > able to figure out how to access a parameter passed into the > partial. Here''s the code I''m using: > > h1 "Create a new note" > > if @note > render :partial => ''form/errors'', :record => @note > end > ... > > (that snippet, as well as the partial is stolen shamelessly from > Restolog (thought converted to Markaby), which is a nice example of > a REST-ful rails app) > > here''s the partial, in form/_errors.mab: > unless record.nil? or record.errors.empty? > div :class => "message-error" do > p "The #{record.class.to_s.downcase} could not be saved:" > > ul do > record.errors.full_messages.each do |m| > li m.gsub(/ id /, '' '') > end > end > end > end > > The error I get is this: > > notes/vendor/plugins/markaby/lib/markaby/builder.rb:203:in > `method_missing'': no such method `record'' > Anyone know what I''m missing here? I suspect that there''s a special > way to access parameters in partials for Markaby, but I haven''t > been able to figure out what it is. > > -- > Larry Wright > http://www.approachingnormal.com > http://www.welcometoparenthood.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 -~----------~----~----~----~------~----~------~--~---
On 9/10/06, Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote:> > > Try putting parens around everything after "render"Nope, no dice. Thanks for the suggestion though. -- Larry Wright http://www.approachingnormal.com http://www.welcometoparenthood.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 -~----------~----~----~----~------~----~------~--~---
try passing a hash:
render({:partial => ''form/errors'', :record => @note})
On Sep 10, 2006, at 12:17 PM, Larry Wright wrote:
> On 9/10/06, Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>
> Try putting parens around everything after "render"
>
> Nope, no dice. Thanks for the suggestion though.
>
>
>
>
> --
> Larry Wright
> http://www.approachingnormal.com
> http://www.welcometoparenthood.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
-~----------~----~----~----~------~----~------~--~---
On 9/10/06, Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote:> > > try passing a hash: > > render({:partial => ''form/errors'', :record => @note}) > > >Still no, unfortunately. Larry Wright http://www.approachingnormal.com http://www.welcometoparenthood.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 -~----------~----~----~----~------~----~------~--~---
On 9/10/06, Larry Wright <larrywright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m trying to use a partial from within Markaby. I haven''t been able to > figure out how to access a parameter passed into the partial. Here''s the > code I''m using: > > h1 "Create a new note" > > if @note > render :partial => ''form/errors'', :record => @note > end > ... >Larry, http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 Third example under "Rendering partials" HTH John W Higgins wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
what about:
render_partial(''form/errors'', @note)
if that fails, try:
helpers.render_partial(''form/errors'', @note)
On Sep 10, 2006, at 7:46 PM, Larry Wright wrote:
> On 9/10/06, Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>
> try passing a hash:
>
> render({:partial => ''form/errors'', :record =>
@note})
>
>
>
> Still no, unfortunately.
>
> Larry Wright
> http://www.approachingnormal.com
> http://www.welcometoparenthood.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
-~----------~----~----~----~------~----~------~--~---
On 9/10/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Larry, > > http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 > > Third example under "Rendering partials" > > HTH > > John W Higgins > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >That did the trick. Thanks! -- Larry Wright http://www.approachingnormal.com http://www.welcometoparenthood.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 -~----------~----~----~----~------~----~------~--~---
On 9/10/06, Larry Wright <larrywright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/10/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Larry, > > > http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 > > > > Third example under "Rendering partials" > > > > HTH > > > > John W Higgins > > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > > That did the trick. Thanks!Why not: render :partial => ''form/errors'', :locals => {:record => @note } ? -ryan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s what the third example shows. On Sep 10, 2006, at 10:51 PM, Ryan King wrote:> > On 9/10/06, Larry Wright <larrywright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On 9/10/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> Larry, >>> >> http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 >>> >>> Third example under "Rendering partials" >>> >>> HTH >>> >>> John W Higgins >>> wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> >>> >> >> That did the trick. Thanks! > > Why not: > > render :partial => ''form/errors'', :locals => {:record => @note } > > ? > > -ryan > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Larry, I''m curious about your general experiences and impressions of using Markaby instead of ERb. Thanks, Jamie On Sep 10, 2006, at 9:46 PM, Larry Wright wrote:> On 9/10/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Larry, > > http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 > > Third example under "Rendering partials" > > HTH > > John W Higgins > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > That did the trick. Thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/11/06, Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote:> > > Hey Larry, I''m curious about your general experiences and impressions > of using Markaby instead of ERb. > > Thanks, > > JamieI like it. General impressions are that it''s cleaner than ERB. I''m not working with a designer, though. If I were, I might use ERB instead as it seems like that would be easier for a designer to work with. My only frustration is the lack of documentation, particularly around things that work differently than ERB (such as this partial thing). Other than that, I like it better than ERB. It certainly means less angle-bracket typing, which is nice. -- Larry Wright http://www.approachingnormal.com http://www.welcometoparenthood.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 -~----------~----~----~----~------~----~------~--~---