Questions tagged [actioncontroller]

ActionController is the main controller class in Ruby on Rails.

ActionController is the main controller class in Ruby on Rails.

424 questions
0
votes
2 answers

How to pass variable from instance method into controller?

I need to call method for each user(admin part), which has email parameter. It is a function for paying in PayPal, but I can't use redirection in instances. Code from my view payments.erb: % @users.each do |user| %>
  • <%= user.email %> <%=…
  • lol
    • 1
    • 1
    0
    votes
    1 answer

    Why I can't use root_path in User instance method?(undefined local variable or method)

    I need to call method for user, which has email parametr. It is function for paying in PayPal and I'm setting return url and cancel url. Here is my method, in user.rb: def pay email require 'httpclient' require 'xmlsimple' clnt =…
    Denys Medynskyi
    • 2,353
    • 8
    • 39
    • 70
    0
    votes
    1 answer

    Rails: Form inputs not saving after submit

    why wont anything entered into this form save? new.html.erb <%= form_for [@requestable, @request] do |f| %> <%= f.label :status %> <%= f.text_field :status, rows: 8 %> <%= f.submit "Request", :class => 'btn'%> <% end…
    0
    votes
    1 answer

    Create a search page in ActiveAdmin

    I'm using ActiveAdmin to deploy my project. And I had some problem when I was developing. I had some database table, e.g: "Worker", "Product", "Task". I wanted to create a page to search on those table with many situation. I created a simple…
    TidusLe
    • 41
    • 1
    • 7
    0
    votes
    0 answers

    Before filter in rails

    Is this good idea set before filter like this ActionController::Base.before_filter { TitleHelper::Taitl.reset } I use this because rails cache classes, and i need to reset variable to make my script work correct Also i don't want call it explicitly…
    timfjord
    • 1,759
    • 19
    • 20
    0
    votes
    1 answer

    MVC: Edit and create in same [HTTPOST] action method

    I am using MVC3-Viewmodel model first on my project. When a user enters a value in my DDL and TextArea and then click on my form button it will basicly execute a ajax url.post to my POST action, right now my Post Action method creates and saves it.…
    Obsivus
    • 8,231
    • 13
    • 52
    • 97
    -1
    votes
    2 answers

    Why does Rails sanitize() perform differently in rspec than in a model?

    In my config/initializers I added the following to the String class: class String def sanitize(options={ tags: %w(div p span strong b em i br ol ul li) }) ActionController::Base.helpers.sanitize(self, options) end end On my local…
    Ando
    • 165
    • 1
    • 14
    -1
    votes
    1 answer

    what is the right way to use ActionController.dispatch in rails

    I have two controllers: controller A and controller B and I'm calling a controller A's actions from Controller B like this: AController.dispatch(:get, request, response) my question is - is it a better practice to pass on a copy of the request…
    nadavgam
    • 2,014
    • 5
    • 20
    • 48
    -1
    votes
    1 answer

    Route params require arguments to be passed to the action

    I have the following code in my routes.rb file - post "/webhooks/process/:webhook_source", controller: :webhooks, action: :process What is expected is that it would pass the webhook_source as a param in the action. Here is the action - def…
    Michael Victor
    • 861
    • 2
    • 18
    • 42
    -1
    votes
    1 answer

    html_safe not working in controller rails 5

    I currently need to send static content using API's created from admin using CKeditor. Now when rendering the html contents in tags are not appering even after using raw and html_safe, escape_html etc render json: {responseCode: xxx,…
    -1
    votes
    1 answer

    How can i call render from inside a Service class or model Class?

    My service authenticate some data on the user's role basis. If the query params are wrong, i want to exit the code and render some error message as the api response? render json: 'something' and return Error that i get it: "status": 500, "error":…
    ashusvirus
    • 412
    • 7
    • 22
    -1
    votes
    1 answer

    what else is the Rails controller doing?

    I have a Rails 4.2 app which is printing shipping labels. The New Relic instrumentation shows that it spends 35% of the time in the controller (not including the operations of the controller method), and I don't understand why. The app flow is…
    Jenna S
    • 616
    • 1
    • 6
    • 24
    -1
    votes
    1 answer

    --- !ruby/hash:ActionController::Parameters controller: welcome action: index

    I looked all over the internet before asking this, I don't know what I did wrong but now that I refresh my index page, this code is showing in the main page: --- !ruby/hash:ActionController::Parameters controller: welcome action: index How do I…
    Luis
    • 1
    • 2
    -1
    votes
    1 answer

    How to create ActionController to get items with list of tags

    Database tables, first table contain tags (id, name) the second table contain relation between items and tags. tags id name 1 TagA 2 TagB 3 TagC tags_items item_id tag_id …
    berhost
    • 1
    • 1
    -1
    votes
    1 answer

    Rails utilize a function in both ActionController and ActiveJob

    We have a generic logging function that is in application.rb under our controllers. This function is not found by active job though (I'm assuming as because our email jobs extend ActiveJob::Base vs our controllers that reference ActionController…
    CogitoErgoSum
    • 2,879
    • 5
    • 32
    • 45
    1 2 3
    28
    29