ruby on rails - ActionMailer before_action is being passed img src's when navigating to new_mailer -


notification controller:

  class notificationscontroller < applicationcontroller   before_action :set_notification, only: [:show, :edit, :update, :destroy]    # /notifications   # /notifications.json   def index     @notifications = notification.all   end    # /notifications/1   # /notifications/1.json   def show   end    # /notifications/new   def new     @notification = notification.new   end   .   .   . private     # use callbacks share common setup or constraints between actions.     def set_notification       @notification = notification.find(params[:id])     end      # never trust parameters scary internet, allow white list through.     def notification_params       params.require(:notification).permit(:name, :email, :subject, :text)     end end 

when new_notification_path link clicked, of prints console

started "/notifications/new" ::1 @ 2017-04-06 23:41:03 -0400 processing notificationscontroller#new html started "/notifications/legal2.jpg" ::1 @ 2017-04-06 23:41:03 -0400 started "/notifications/photo1.jpg" ::1 @ 2017-04-06 23:41:03 -0400 processing notificationscontroller#show jpeg processing notificationscontroller#show jpeg   parameters: {"id"=>"legal2"}   rendering notifications/new.html.erb within layouts/application   parameters: {"id"=>"photo1"}   notification load (0.5ms)  select  "notifications".* "notifications" "notifications"."id" = ? limit ?  [["id", 0], ["limit", 1]]   notification load (0.0ms)  select  "notifications".* "notifications" "notifications"."id" = ? limit ?  [["id", 0], ["limit", 1]]   rendered notifications/_form.html.erb (1.5ms) completed 404 not found in 15ms (activerecord: 0.5ms)   completed 404 not found in 4ms (activerecord: 0.0ms)     rendered notifications/new.html.erb within layouts/application (14.9ms)   activerecord::recordnotfound (couldn't find notification 'id'=legal2): activerecord::recordnotfound (couldn't find notification 'id'=photo1):   app/controllers/notifications_controller.rb:69:in `set_notification' app/controllers/notifications_controller.rb:69:in `set_notification' completed 200 ok in 198ms (views: 186.0ms | activerecord: 0.0ms)     rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (2.0ms)   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (2.0ms)   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.5ms)   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (1476.0ms)   rendering c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)   rendered c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (1644.6ms) 

why there call notificationscontroller#show 2 photo sources parameters , why set_notification being called if 'new' action being called?

error getting generated view. maybe trying set image based on direct path. use rails assets helper methods

<%= image_tag asset_path("myimage.jpg"), size: '200x200', class: 'img-responsive' %> 

it use assets path images in folder (app/assets/images) , work on both development , in production compiled assests )

hope helps...


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -