Home how to call action from model to controller in ruby on rails
Reply: 0

how to call action from model to controller in ruby on rails

user451
1#
user451 Published in June 23, 2018, 4:20 am

I am trying to call 'checking' action from post model.

class Post < ApplicationRecord
     after_commit :testing
     def testing
         @id = "#{self.id}"
         puts @id
         checking # call action to controller 
     end
end

posts_controller.rb

def checking
  puts "not Working"
end

I am trying to achieve the above, whereas it is not getting called.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.320076 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO