Questions tagged [url-helper]

29 questions
36
votes
2 answers

Rails - How to add a format to an url helper?

how can I make an URL helper create an URL in a given request/response format? For example, in my test I have the following: get(activity_url(activity)) This will returns me an HTML on the @response object. I'm looking to have the same behavior of…
fotanus
  • 19,618
  • 13
  • 77
  • 111
24
votes
3 answers

undefined method 'link_to'

I'm writing a ruby-on-rails library module: module Facets class Facet attr_accessor :name, :display_name, :category, :group, :special ... URI = {:controller => 'wiki', :action => 'plants'} SEARCH = {:status =>…
Mike Sutton
  • 4,191
  • 4
  • 29
  • 42
5
votes
3 answers

Rails: Use URL Helper in Observer

I have an observer which looks like this: class CommentObserver < ActiveRecord::Observer include ActionView::Helpers::UrlHelper def after_create(comment) message = "#{link_to comment.user.full_name, user_path(comment.user)}…
Andrew
  • 42,517
  • 51
  • 181
  • 281
5
votes
3 answers

Why did Ruby on Rails' URL Helper put a period in my URL?

I have the following code in my view (RoR 4): tbody - @order_submissions.each do |order_submission| tr td = order_submission.id td.table-actions span = link_to "Show", order_submissions_path(order_submission.id) td =…
fuzzybabybunny
  • 5,146
  • 6
  • 32
  • 58
4
votes
1 answer

Url.Link not working in WebAPI

Using the unit test below .. Iam trying to test my webapi. [Test] public void CheckControllerForCreate() { var config = new HttpConfiguration(); config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; var request = new…
ashutosh raina
  • 9,228
  • 12
  • 44
  • 80
3
votes
1 answer

UrlHelper class throws null exception in Asp.net mvc

I am developing an Asp.net mvc web application. I am doing Unit Test to my application. I am using Moq to mock objects. I am trying to mock Url helper class. I found this link- asp.net mvc: how to mock Url.Content("~")?. Using that class, I can mock…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
3
votes
4 answers

Rails 4.2 - url helper raises "ArgumentError: wrong number of arguments (3 for 1..2)"

We are upgrading our Rails app from 4.1 to 4.2. While this code works great in 4.0 and 4.1: admin_root_url(:subdomain => 'www') When I try it on 4.2.3 I get this error: ArgumentError: wrong number of arguments (3 for 1..2) I checked it several…
guyaloni
  • 4,972
  • 5
  • 52
  • 92
2
votes
0 answers

Overriding DateTime format in System.Web.Http.UrlHelper

Problem: Given my Asp.NET Web API is set up as follows Platform: ASP.NET 4.5, Owin, C#, Globalisation Culture: en-GB When I create a Url link using UrlHelper in the ApiController with date from set to Today, 2nd Sept 2016: var someObject = new…
2
votes
1 answer

Laravel URL helper: How to generate a perfect URL with query parameters and hash

Suppose the route is like this: Route::get('messages/{messages}', ['as' => 'messages.show', 'uses' => 'MessagesController@show']); So, when we will create an URL using URL helper of Laravel, {{ route('messages.show', 12) }} will display…
Debiprasad
  • 5,895
  • 16
  • 67
  • 95
2
votes
1 answer

URIs with german special characters don't work (error 404) in Zend Framework 2

I want to get a list of cities, where each city name is linked and refers a page for this city: The links (created in the view script) look like this: http://project.loc/catalog/Berlin (in the HTML source code url-encoded:…
automatix
  • 14,018
  • 26
  • 105
  • 230
2
votes
0 answers

How do I "unscope" an edit path and/or action in Rails 3?

Currently I'm working on a simple Rails 3 web application with devise. When users sign up an Account is created. This the essence of the Account model: class Account < ActiveRecord::Base include Authority::UserAbilities # Callbacks …
1
vote
2 answers

Why rails_blob_url in the application and in the test works generates different links?

In ReviewsController serializers are used to display json. Like here: render json: @reviews, each_serializer: ReviewSerializer, root: false The serializer uses the following attribute :image. Like this: class ReviewSerializer <…
1
vote
2 answers

Zend Framework URL - How to pass a query string?

I have this link: Form With this I get something like: http://foo.com/form I need to pass a param to the URL with…
MEM
  • 30,529
  • 42
  • 121
  • 191
1
vote
3 answers

codeigniter 4 how to make menu bar links

I am a beginner at CodeIgniter. I want to know how to link one page to another. I tried to like this. I got the error 404 - File Not Found Sorry! I cannot seem to find the page you were looking for. What I tried so far I attached below. view…
hari dran
  • 115
  • 3
  • 16
1
vote
0 answers

Url helper with constraints for a subdomain rails app

My rails app have two servers and the urls are: staging.subdomain.example.com subdomain.example.com And my routes look like: ['staging.', ''].each do |prefix| constraints subdomain: "#{prefix}subdomain" do scope module: "subdomain" do …
Stephen
  • 3,822
  • 2
  • 25
  • 45
1
2