songrit / mindapp

generate ror app from mind map
MIT License
17 stars 5 forks source link

return error from view expected parameter #6

Closed kul1 closed 10 years ago

kul1 commented 10 years ago

When view display simple html command after click Next it return error instead of return to the default Menu/Screen.

id task step starter begin message 71 Show show_article admin Sat May 17 07:47:20 2014 undefined method `parameters' for nil:NilClass["/Users/Kul/.rvm/gems/ruby-1.9.3-p545@rails322/gem...

Here my related files:

articles_controller.rb

class ArticlesController < ApplicationController
def create_article Article.create $xvars["enter"]["article"] end
def show_article_last @title = "หนังสือ" end end

show.html.erb

<% @articles = Article.last %> <% @ttt = @title %>

Record from @articles = Article.last = <% @articles %>

Title @title = "หนังสือ" passed from articles_controllers.rb =
<%= @ttt %>

article name from @article.name = <%=@articles.name %>

article content from @articles.content = <%=@articles.content %>

screen shot 2557-05-17 at 4 13 25 pm

songrit commented 10 years ago

look like error in show.html.erb please be aware that view and controller in this particular case has nothing to do with each other. They are in different steps in mind map tree. If you really need to put logic in view, you can do so using erb tag <% %> although I would suggest you'd better put them in model or helper. OR put a controller step BEFORE the view step to prepare $xvars ready to be used LATER.

On Sat, May 17, 2014 at 4:16 PM, kul1 notifications@github.com wrote:

When view display simple html command after click Next it return error instead of return to the default Menu/Screen.

id task step starter begin message 71 Show show_article admin Sat May 17 07:47:20 2014 undefined method `parameters' for nil:NilClass["/Users/Kul/.rvm/gems/ruby-1.9.3-p545@rails322 /gem... Here my related files: articles_controller.rb

class ArticlesController < ApplicationController

def create_article Article.create $xvars["enter"]["article"] end

def show_article_last @title https://github.com/title = "˹ѧÊ×Í" end end show.html.erb

<% @articles https://github.com/articles = Article.last %> <% @ttt https://github.com/ttt = @title https://github.com/title %>

Record from @articles https://github.com/articles = Article.last = <% @articles https://github.com/articles %>

Title @title = "˹ѧÊ×Í" passed from articles_controllers.rb =

<%= @ttt %>

article name from @article.name = <%=@articles.name %>

article content from @articles.content = <%=@articles.content %>

[image: screen shot 2557-05-17 at 4 13 25 pm]https://cloud.githubusercontent.com/assets/3953832/3004523/90fddd5a-dda3-11e3-93f7-5335af574b2b.png

Reply to this email directly or view it on GitHubhttps://github.com/songrit/mindapp/issues/6 .

kul1 commented 10 years ago

OK I removed star show_article_last then it worked. Thanks