On 23 April 2011 13:40, amrit pal pathak <[email protected]> wrote:
>
>
> On Apr 23, 8:26 am, Colin Law <[email protected]> wrote:
>> On 23 April 2011 13:18, amrit pal pathak <[email protected]> wrote:
>>
>>
>>
>> > I generated a simple controller using "script/generate controller form
>> > myfun".Then edited a /app/view/form/myfun.html.erb simply as
>> > <h1>Hello</h1>
>> > <%=link_to 'Submit'%>
>>
>> > I created a another
>> > controller using "script/generate controller click fun".Edited the app/
>> > view/click/fun.html.erb to hold a welcome message as
>>
>> > <h1>Welcome</h1>
>> > I want click on
>> > submit should show this message,but dont know how to connect these two
>> > controllers.using rails .I am using rails 3.0.7.
>>
>> It is important to distinguish between the three components Model View
>> Controller of MVC design. If you are not clear on these then some
>> googling and reading might be worthwhile. I presume that what you
>> actually want to do is link to a controller action from the _view_ of
>> another controller. To do that simply put use link_to to link to the
>> the controller/action that you want.
> I add the link to click controller(it has a fun action)
You are confusing controller and view again, you cannot add a link to
a controller, only to a view.
> as ,but i gave error(may be a syntax error in specifying a controller
> path).
> <h1>Hello</h1>
> <%=link_to 'Submit',click_path%>
That should probably be clicks_path (plural). If you run
rake routes
it will show you the routes you have defined, one of which will be
something like
clicks GET /clicks(.:format) {:controller=>"clicks",
:action=>"index"}
which will tell you that clicks_path is a valid route.
Colin
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.