ruby - Mailboxer with rails 4 (undefined local variable or method `root_url') -
ruby - Mailboxer with rails 4 (undefined local variable or method `root_url') -
update
the error rails cant find root_url
visit <%= link_to root_url, root_url %> , go inbox more info.
for quick prepare , dont need sent user root_url notification user go app. alter code this: on mailbox email views
visit **messages** , go inbox more info.
question
i got devise set rails 4 app. im next illustration mailboxer-app when sent message error:
`error undefined local variable or method `root_url' #<#<class:0x007ffe0b881678>:0x007ffe0b068298>`
stuff have prepare working
got form sending message user email user can sent , reply mark delete view inbox,sentbox , trashthis steps
install gem -v 0.12.1 rails g mailboxer:install run migration use code illustration app(controller,view,routes) add user.rb acts_as_messageable ,conversations controller
before_filter :authenticate_user! helper_method :mailbox, :conversation def index @inbox ||= current_user.mailbox.inbox.paginate(:page => params[:inbox], :per_page => 5 ) @sentbox ||= current_user.mailbox.sentbox.paginate(:page => params[:sentbox], :per_page => 5 ) @trash ||= current_user.mailbox.trash.paginate(:page => params[:trash], :per_page => 5 ) end def create recipient_emails = conversation_params(:recipients).split(',') recipients = user.where(email: recipient_emails).all conversation = current_user. send_message(recipients, *conversation_params(:body, :subject)).conversation redirect_to :conversations end
form
<%= bootstrap_form_for :conversation, url: :conversations |f| %> <%= f.text_field :recipients%> <%= f.text_field :subject%> <%= f.text_field :body %> <div class="form-actions"> <%= f.primary "send" %> <%= submit_tag 'cancel', type: :reset, class: 'btn btn-danger' %> </div> <% end %>
view
<% @inbox.each |conversation| %> <%= conversation.originator.username%> <%= link_to raw(truncate(strip_tags(conversation.subject), :length => 15)), conversation_path(conversation) %> <% end %>
ok got prepare problem. happen mailboxer mailer looking root_url. rails 4.1 wont generate views re-create files source code , works greate.
and alter part of code here.
view/mailboxer/all of files message_mailer notification_mailer
change
visit <%= link_to root_url, root_url %> , go inbox more info.
to
visit **messages** , go inbox more info.
thanx guy supremebeing7. on mailboxer issue page
ruby-on-rails ruby mailboxer
Comments
Post a Comment