Friday 15 June 2012

Best steps for trouble shooting rails app -


The best (easiest way) to run through MVC and check whether everything is correct?

I am getting a little dazzling and I feel like there should be simple improvements in such error messages as actually

  undefined Method # invites_path 'for # & lt; # & Lt; Class: 0x00000105ad5cb8>: 0x00000105820b30>   

After breaking the code of my app, after adding the code in a small quantity and I want to trouble them in shooting myself.

Thanks for the tips!

Edit

Perhaps a typical approach to troubleshooting specific issues will take the way,

  • Link_to is not used to link & lt;% =% & gt; & Lt; %% & gt; Instead.
  • The above error occurs in the Local Error: 3000 / Invitation / New

    View (home / index.erb.html) < / P>

      & lt;% if @ user.invitation_limit & gt; 0% & gt; & Lt;% link_to 'Send Invitation', new_invitation_path% & gt; (& Lt;% = @ user.invitation_limit%> left) & lt;% end% & gt;   

    View (in invitation / new.erb.html)

      for & lt;% = error_messages_: invitation% & Gt; @Ivision for & lt;% form_ F | & Gt%; & Lt; P & gt; & Lt;% = f.label: Recipient_Email, "Friend's Email Address"%> & Lt; Br / & gt; & Lt;% = f.text_field: recipient_email% & gt; & Lt; / P & gt; & Lt; P & gt; & Lt;% = f.submit "Invitation!" % & Gt; & Lt; / P & gt; & Lt;% end% & gt;   

    Controller

      Class invitations controller & lt; ApplicationController def new @invitation = invite.new end def @ invite = invitation New (Consulting:: Invitation)) @ Invitation. Sign = Current_User if @ Invitation. Mailer.deliver_invitation (@ invitation, signup_url (@ invitation.token) Flash [: notice] = "Thanks, invitation sent." Redirect_to projects_url else flash [: notice] = "Thanks, we will inform you when we are ready." Redirect_to root_url End End Render: Action => 'New' and end   

    model

      class invitation & lt; ActiveRecord :: base is_to: sender, class_name = & gt; 'User' is_one: recipient, class_name = & gt; 'User' attr_accessible: recipient_email,: sender_id ,: sent_at,: token end   

    routes.rb

      resources: home ,: Only: & gt; : Indicator processing resource: Invitation    

    You can create request glasses for each controller Request specs follow the request in all ways to see from the controller, and if there is an error, this request will appear in the device.

    It may take time to set up, but will save you for a long time in the future, as you would like to roll out a new version of your website, then manually There is no need to test.

No comments:

Post a Comment