Questions tagged [actionpack]

Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.

74 questions
21
votes
3 answers

What approach do you take for embedding links in flash messages?

The ability to have flash messages (notice, error, warning, etc) with embedded links is nice from a user interaction standpoint. However, embedding an anchor tag inside a flash message from the controller is dirty. Let's assume that a flash message…
Ryan McGeary
  • 235,892
  • 13
  • 95
  • 104
16
votes
2 answers

Rails: How do I require NumberHelper and make it work?

I'm trying to write a simple Sinatra thingy but I need ActionView::Helpers::NumberHelper from action pack. http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html The question is, how do I install and use it? irb(main):001:0>…
alamar
  • 18,729
  • 4
  • 64
  • 97
11
votes
2 answers

What is the opposite of url_for in Rails? A function that takes a path and generates the interpreted route?

Brain's a little fried....How do I get a hash of the :controller and :action from a relative_path? This is basically the opposite of url_for. in the example below, "some_function" is the mystery function name I'm looking for...I know it's easy, just…
btelles
  • 5,390
  • 7
  • 46
  • 78
7
votes
1 answer

Active Admin : Can't access show/edit pages

I'm having an issue with Active Admin. Here are the versions : ruby '2.2.1' rails '4.2.0' activeadmin : 1.0.0.pre1 arbre : 1.0.3 (mentioning this one because it seems to be linked to my issue somehow) We upgraded to rails 4.2 and had to upgrade…
BPruvost
  • 503
  • 2
  • 5
  • 16
6
votes
1 answer

Getting rid of DEPRECATION WARNING: env is deprecated and will be removed from Rails 5.0.

While migrating to Rails 5.0.0.beta1 I discovered lots of deprecation warning : DEPRECATION WARNING: env is deprecated and will be removed from Rails 5.0. (called from XXX at YYY) I've tried to get rid of that and try to find an alternative but…
Dorian
  • 2,571
  • 23
  • 33
5
votes
2 answers

Ruby-on-Rails: Help with render: layout => false

I am trying to access a rails app resource from an API (it sends an Application/XML GET request) and I would like to not have to parse the XML file. In my resources controller I have the following: def get_resource @my_resource = Resources.new …
David
  • 7,310
  • 6
  • 41
  • 63
5
votes
3 answers

Rails 4.1.2 - to_param escapes slashes (and breaks app)

I use in my app to_param to create custom URL (this custom path contains slashes): class Machine < ActiveRecord::Base def to_param MachinePrettyPath.show_path(self, cut_model_text: true) end end The thing is, that since Rails 4.1.2…
ExiRe
  • 4,727
  • 7
  • 47
  • 92
4
votes
1 answer

Accessing Rails cookies by domain

I have a situation in which two cookies have the same name but slightly different domains (cookie1 has the domain example.com whereas cookie2 has sub-domain inclusive .example.com). cookies[ :cookie_name ] = { :value => "test_value_cookie_1",…
Ethan Heilman
  • 16,347
  • 11
  • 61
  • 88
4
votes
2 answers

Integrating HAML with RSPEC

I had 11 or so Rspec tests running sat, until I converted my project to HAML. Then when I ran my tests, I got errors such as: ActionView::MissingTemplate: Missing template pages/home with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml],…
D. Simpson
  • 1,882
  • 17
  • 32
4
votes
1 answer

New error while upgrading to Rails 5: NoMethodError (undefined method `id' for {}:Hash)

I recently upgraded to Rails 5. After upgrading and the fixing the usual things, my application appeared to be running correctly and serving responses. Even though my test suite passes with 94% coverage, when performing an actual request, the…
Rick
  • 8,366
  • 8
  • 47
  • 76
4
votes
2 answers

Action Pack Design and Development - am I missing something

The Action Pack (see here: https://partner.microsoft.com/global/40138499) seems to be incredibly good value if I am understanding it correctly. The price is $490 and if I'm understanding correctly it comes with 3x VS2010 Professional licenses, and…
Sam
  • 4,219
  • 7
  • 52
  • 80
3
votes
1 answer

Rails: What does calling ActionController::Parameters#permit() achieve when not using the object returned by it?

I understand that calling params.permit(:foo) creates a new ActionController::Parameters instance with :foo whitelisted so that you can instantiate a model with it. But why does the following code in the Discourse CMS call it without using its…
Samuel Katz
  • 24,066
  • 8
  • 71
  • 57
3
votes
1 answer

How to fix an "Invalid query parameters" error in a Rails app?

A user recently triggered an error while he was signing up to our website. I've tried to reproduce the error but I didn't succeed. I understand that there is a problem with the "é" character. It is not being recognized for this particular user, but…
Benjamin
  • 521
  • 1
  • 8
  • 19
3
votes
1 answer

Restrict length of log output in Rails

I have an API that accepts base64 encoded images. The requests come in looking like: { image: "ijt41ig8ahbha8oij4j1tjletc" } The base64 encoded strings can be very large, sometimes 10k - 100k characters. When a request is sent with improperly…
mccalljt
  • 786
  • 3
  • 14
3
votes
1 answer

Rendering an "internal" Rails controller from a middleware

I have a Rails middleware stack, and I have a piece of MW outside ActionDispatch. Ideally I would like to render a page using ActionDispatch by triggering a URL which is internal (not accessible via usual URL routes) - similar to the way Devise…
Julik
  • 7,676
  • 2
  • 34
  • 48
1
2 3 4 5