Forum: Ruby on Rails A function that return a link_to, Possible ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
oo00oo (Guest)
on 2006-01-16 19:31
(Received via mailing list)
Hello, I try this :

in application_helper.rb
-----------------------

def lnk bla
    return link_to bla,  { :controller => bli , :action => "blo" , :id
=> "blu" }
end

in file.rhtml
-----------

<%= lnk "yo!" %>

This return an error. There is a way to do this or something similar, or
this is completly impossible ?

Thanks
Joe Van D. (Guest)
on 2006-01-16 19:34
(Received via mailing list)
On 1/16/06, oo00oo <removed_email_address@domain.invalid> wrote:
> Hello, I try this :
>
> in application_helper.rb
> -----------------------
>
> def lnk bla
>     return link_to bla,  { :controller => bli , :action => "blo" , :id
> => "blu" }

I think you mean :controller => "bli", right?

In the future, it's nice to give the actual error you receive when
stuff doesn't work.

Joe
oo00oo (Guest)
on 2006-01-16 19:52
(Received via mailing list)
_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails
Mike H. (Guest)
on 2006-01-16 20:11
(Received via mailing list)
The link break in the middle of the statement, does that exist in the
actual code.  Does that would definitely cause the error.
Jens A. (Guest)
on 2006-01-16 20:11
(Received via mailing list)
On 16 Jan '06, at 9:50 AM, oo00oo wrote:

> def lnk bla
>     return link_to bla,  { :controller => "bli" , :action =>
> "blo" , :id
> => "blu" }
> end

If there really is a line break before '=>' in your source code, then
that's a syntax error.

I took your code and pasted it into my app, removing that line break,
and it compiles fine, apart from a warning that you should put parens
around the method arguments. I have similar methods in my own code.

--Jens
oo00oo (Guest)
on 2006-01-16 20:20
(Received via mailing list)
Thanks to all :)
This topic is locked and can not be replied to.