ruby-on-rails-3,url,pagination,format,kaminari , How config url in Kaminari pagination? '.json' appended automatically

How config url in Kaminari pagination? '.json' appended automatically


Tag: ruby-on-rails-3,url,pagination,format,kaminari

Load table with Kaminari pagination using AJAX. The pagination itself is using AJAX as well.

In my controller:

def update_user_list
  modal = render_to_string('tables/_user_table', :layout => false, :formats=>[:html]).html_safe
  data = {
    :table => modal
  respond_to do |format|
    format.json { render :json => data }

In tables/_user_table

# Table part and content notrelated
<%= paginate @users, :params => {:controller => 'product', :action => 'more_users'}, :remote => true, :theme => 'twitter-bootstrap-3' %>

The response JSON of update_user_list looks like:

  table=" // the table part
          // the pagination part shows as follows
          <li class="page"><a href="/product/more_users.json?page=3&amp;user_subgroup_id=1" data-remote="true">3</a></li>
          <li class="page"><a href="/product/more_users.json?page=4&amp;user_subgroup_id=1" data-remote="true">4</a>

What I want is to remove ".json" in the url.

If I just render tables/_user_table without AJAX, not in a JSON object, it doesn't have ".json" in the url.

version: rails: 3.2.17 kaminari: 0.13.0 bootstrap-kaminari-views: 0.0.3


Find the problem. It's actually not included in the question.

   url: '<%= user_product_index_url %>.json',
   success: function(data) {
      // not important......

remove ".json" here solve the problem...


Getting HTTP 302 when downloading file in Java using Apache Commons

I am using the following method to download a file off the internet: try { URL url = new URL(""); FileUtils.copyURLToFile(url, new File(jsonerFolder.getParent() + "\\mods\\json-io-4.0.0.jar")); } catch (Exception e1) { logger.error("Downloading json-io failed with an exception"); e1.printStackTrace(); } But the downloaded file is not a jar, rather, it is an...

Get special character from Query string in classic asp

I have an URL like ViewProfile.asp?mem_id=phani#1&page=1 I am trying to get the value of mem_id by using request.Querystring("mem_id"), I am getting only phani. The part #1 of it is not coming to the variable. I have used HttpUtility.UrlDecode() and Server.UrlDecode(). I am not sure whether these are there. Can someone...

why i am not able to read Html Content from a website in a file?

I have made a java program where in i can use any website to read its Html Content using Scanner class and Varargs.I am not able to get the output while i am using Scanner class and VarArgs. Below is the following Code. import; import; import; import...

CodeIgniter URL parsing incorrectly

I have a code igniter site which I have enabled some special characters so that characters such as £ can be used in the URL: EG:£ When I click on the URL, it tries to take me to the product page and then redirects me back to the homepage....

CakePHP 1.3 - Extract URL GET parameters

I have CakePHP 1.3.2 application working with similar URLs: /controller/action/name1:value1/name2:value2.html I'm trying to extract the values after the : sign specified by the names before that. I can see the whole URL with no problem using $this->params['url'], however, I can't get the value itself using neither $this->params['name1'], nor $this->params['url']['name1']. Any...

Get Parameter from URL using PHP

I have a url: I am currently successfully passing the postback parameter using the PHP below. However, I can not figure out how to also pass the city parameter. <?php session_start(); if(isset($_SESSION['postback'])) { if($_GET['postback'] == "") { header ("Location: qualify-step2.php?postback=".$_SESSION['postback']); } } ?> Can someone please help me edit...

PHP - url path as parameters

My question might be silly, but I have no idea how to do it. I'm using PHP for creating websites. To change content of the page there is script which includes different file based on url parameter, eg. This loads some news page. When I want to load some...

Print variables coming to model's methods

Having following code: class MyModel < ActiveRecord::Base before_create :do_process def do_process #I want to print here everything that came to this method self.my_stuff = my_stuff end Say we have model with name and description attributes and I'm going into console and enter something like MyModel.create! name: 'test', description: 'test' So...

How to generate a new url for each site

I'm currently making a website with the system of replacing content of the main div in the "body" part. Now I figured out that I messed up a bit because every content will be placed in the same url. Do you have a idea of fixing this? HTML/PHP(index.php): <html> <head>...

how to get a response of running an API on remote rails server from another rails application

I have to rails application, my aim is to call an API on remote rails application and get back the result of that API. for example: 1st Application has update() API which does some processing and create a hash called data Now I want to call update() from 2nd Application...

Heroku RAM not increasing with upgraded dynos

I have a massive function i have been calling manually through the heroku rails console. I have been receiving the error rapid fire in my logs: 2015-06-22T14:56:42.940517+00:00 heroku[run.9877]: Process running mem=575M(112.4%) 2015-06-22T14:56:42.940517+00:00 heroku[run.9877]: Error R14 (Memory quota exceeded) A 1X dyno is suppose to have 512 MB of RAM. I...

Twitter Boostrap in Rails

I generated views using this command rails g bootstrap:themed Todo it generated several views for my model. I am using git and reverted the project to its former branch without the boostrap. Now, I am trying to regenerate the views but it always returns this identical app/views/manifests/index.html.erb How do I...

C# mvc4 - direct URL to controller

I have an external URL that points directly to a function in my controller but when I click on it for the first time, instead of reaching the page, I get to the home page. However, on the second click (and the following ones), I can reach the desired page....

has_and_belongs_to_many loads wrong resource

I have 3 models # generic one class Someone < ActiveRecord::Base end # customer class Customer < Someone has_and_belongs_to_many :groups, join_table: "some_join_table", class_name: "Group" end # custom group class Group < GenericGroup has_and_belongs_to_many :customers, join_table: 'some_join_table', class_name: "Customer" end Let's assume that database is feeded. When i execute command Customer.first.groups...

Changing URL as long as you are scrolling the webpage

I was seeing the NASA's press release / image gallery, (you can see it here) and it has come to my attention that as I'm scrolling down the webpage and seeing different posts, the URL in the address bar was changing (I was using chrome, but tried in Internet Explorer...

Encrypted Querystring in URL getting changed to lowercase in Outlook

I am providing a CANCEL button in a registration email, so that the user can click the link and cancel their registration. This works fine except Outlook is converting links to lowercase. So when the user clicks the link, I can't decrypt the URL because the encrypted querystring is now...

What is the semantic HTML tag to display for URLs that are not links?

I have a search engine plugin that outputs results in a basic structure: <a href="page url"> <div class="searchResult"> <h3>Page title</h3> <p>Page url</p> <p>Page <meta> description</p> </div> </a> The plugin is designed to integrate into an existing website so it has no default styling. However, websites are supposed to be usable...

Rails view URL to another website

In my view I display a url to another website like so: <a href="url"><%= @article.url %></a> However, when I click it, my website crashes(it probably interprets it as a url to another page within the website). How can I change this code such that the url takes me to another...

Cross-Domain iFrame Tracking with Google Analytics

I have a site (rails 3.2) that displays 3rd party news articles within an iframe. One page contains one iframe. I have Google Analytics setup. For this I use The tracking script is in the head section of the container page. We have no affiliation with the 3rd party...

Clean Urls with regular expression

i have Data in thousand lines like 60% 2 Weekly 2014-01-01 00:00 want to remove everything after / in every url (output should be in clean url like below) Thanks ...

Htaccess rewrite URL with virtual directory and 2 variables

its my URL... result.php?team=arsenal&player=ospina I want to like this I tried this code.. cant work.. Not Found RewriteRule ^(.*)/(.*)/(.*).html$ result.php?team=$2&player=$3 [L] The requested URL /subfolder/arsenal/ospina.html was not found on this server. Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 80 Thanks for helps, Best regards!!...

Build urls with parameters

I'm trying to generate a URL similar to­‐web/processTransaction?REQUEST_TYPE=2&MID=5 I'm using PHP's http_build_query function but it's not generating a proper URL. Code sample: <?php $parameters =array( '­‐web/processTransaction?', 'REQUEST_TYPE'=>'2', 'MID'=>'5'); $url = http_build_query($parameters); echo $url; ?> ...

Trying to pass variable in url

I'm echoing this form: echo "<form action='/leaguemaster/fichaTorneio.php?id=" . $_GET['torneioid'] . "'>"; When I submit the form and it links to the page from the action, the variable I'm passing doesn't reach the page... /leaguemaster/fichaTorneio.php? I've done this in other pages and it worked, I don't know what's going on here....

Rails wrong number of arguments (1 for 0), ArgumentError in SubscribeController#update

I created a subscribe section using stripe. But I am having an issue with the routing. I'm not sure whats happening or what to do. Any help would be appreciated Migration to User Model class AddExtraDetailsToUser < ActiveRecord::Migration def change add_column :users, :subscribed, :boolean, :default => false add_column :users, :stripeid,...

Custom Search in Ruby on Rails

I'm trying to implement a custom search feature in my Rails app. I have 3 tables User Company and CompanyUser My relations declared are as follows class CompanyUser < ActiveRecord::Base belongs_to :company belongs_to :user ... end In Company.rb has_many :company_users, dependent: :destroy has_many :users, through: :company_users In User.rb has_many :company_users,...

how is youtube url constructed?

I am wondering how the youtube url is constructed? for example how is the value L7Jd910Bw8 created, is it a hash value ? is there any PHP function to use for creating this kind of urls? how is it possible to make sure that the two diffrent objects dont...

Django: html without CSS and the right text

First of all, this website that I'm trying to build is my first, so take it easy. Thanks. Anyway, I have my home page, home.html, that extends from base.html, and joke.html, that also extends base.html. The home page works just fine, but not the joke page. Here are some parts...

Devise nested attributes form field not showing

I am having trouble viewing the nested attributes field in my form. I am in the jobs/new view and I want have a User form that creates a job as well as a user. I have everything in this answer Rails 4.0 with Devise. Nested attributes Unpermited parameters I have...

Punycode for Unicode query parameter

I am trying encode some Unicode URLs with Punycode. These URLs have a query parameter that contains non-ASCII characters, for example:œlia&printable=yes The problem is, when I try to do it in Java, the resulting URL is wrong: String link = "œlia&printable=yes"; link = IDN.toASCII(link); // -> link =

Force WWW when URL contains path using .htaccess

I'm having a problem with my URL and my sessions. I wish to have ALL website pages be forced to use www. As it looks like now, the website looks like this: into into into into (this is what's wrong) This is...

htaccess rewrite rules conflict

php,.htaccess,url,mod-rewrite problem with the rewririte rules in .htaccess file. my current .htaccess file looks like this. RewriteRule ^([0-9a-zA-Z_-]+)/([0-9]+)$ products.php?cat=$1&id=$2 [NC,L] RewriteRule ^([^/]*)/([0-9a-zA-Z_-]+)/([0-9]+)$ product_categories.php?cat=$2&id=$3 [NC,L] RewriteRule ^(.*)/(.*)/([0-9a-zA-Z_-]+)/([0-9]+)$ product_details.php?cat=$3&id=$4 [NC,L] RewriteRule ^([0-9]+)$ gallery.php?id=$1 [NC,L] I'm trying create urls like the following.

What is Fragment URLs and why to use it

I am new in PHP Development. Today I came across the interesting topic URL fragmentation specifically the '#' part of the URLs. I searched about that It says it's like\foo.html#bar. But I don't understand why this "#bar" is needed. and how to read it by PHP?...

How to build custom URL by adding ?¶ms in Angular?

I'm trying to build a custom URL and update the URL as the user selects items in my dashboard. For example, after clicking a few items the URL could/should look like: #/dashboard?&portfolio=GOOG&ticker1=GOOG Currently the URL only ends in /dashboard (console.log($location.path());) How would I update the $location.path() to add params like...

Servlet path is not included in

I have a simple Java Webapp (eg. test) containing two different SpringMVC application. My web.xml maps them as: <servlet-mapping> <servlet-name>web</servlet-name> <url-pattern>/web/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>restful</servlet-name> <url-pattern>/restful/*</url-pattern> </servlet-mapping> Inside the web part I'm using "classic" libraries, such as JSTL core. I don't understand how to avoid JSTL c:url tag ignoring the URL...

Open website url links with parameter by using a batch file

I am trying to open some website url links with a parameter in my browser. I made a batch file using this code : @echo off start "images" "" start "images" "" start "images" "" ... ... start "images" "" All I want is to create a For loop that...

Convert a column of text URLs into active hyperlinks in Shiny

I am creating a user interface for a pathway enrichment program. The results are shown in a table as shown below. Below is a snippet showing that I am using DT::renderDataTable and DT::datatable to output the table in a tab. spia_out() is just a reactive function that runs the pathway...

GitHub API returned Url meaning

Take this very simple API as example, In the JSON formatted response, you'll find something like following, "following_url":"{/other_user}", "gists_url": "{/gist_id}", "starred_url": "{/owner}{/repo}", Ok, I know like the following_url, starred_url is something like a sub API which you can call to fetch who that user are following, or what repos...

Rails - How to find tilt version?

Gem tilt is used with sprockets for Rails assets precompile. We are having hard time to find the version running on our Rails 4 app as tilt --version returns version unknown: $ tilt --version tilt: version unknown tilt --help give no info about how to find version. Is there way...

ApplicationController helper method undefined in Rails

I'm trying to write a simple helper method that checks if a user's email address contains a specific domain name. The method is needed in all my controllers and depends on the state of current_user, so I felt the best place to put it would be in my ApplicationController. Depending...

Java - Getting the URL's parameter

I have a URL something like this I'm using play framework HTTP Routes: GET /students controllers.Application.Get() POST /students controllers.Application.Post() PUT /students/{studentNo} controllers.Application.Put() How will I get the {studentNo} value? For example I'm using a postman(rest client) and I typed something in the url http://localhost:9000/students/2012111222 , how will I get the...

How can I detect a URL really exists despite a 301 or 302 redirect?

I am looking to write a function in python to confirm the existence of files that might exist on a remote server. Some of the downloads I am checking, however, are behind 301 or 302 redirects. I have tried using the requests module as follows: def exists(path): r = requests.head(path)...

Rails less url path change

Developing a Rails application with the less-rails gem I found something unusual : // app/assets/common/css/desktop/typo.less @font-face{ font-family:'SomeFont'; src:url("fonts/db92e416-da16-4ae2-a4c9-378dc24b7952.eot?#iefix"); // ... } The requested font is app/assets/common/css/fonts/db92e416-da16-4ae2-a4c9-378dc24b7952.eot This font is compiled with less and the results is : @font-face { font-family: 'SomeFont'; src: url("desktop/fonts/db92e416-da16-4ae2-a4c9-378dc24b7952.eot?#iefix"); //... } Do you know why is...

Creating a object with nested form rails

I have 3 tables: members, meetings, meeting_has_members. The models are: member.rb class Member < ActiveRecord::Base has_many :meeting_has_members has_many :meetings, through: :meeting_has_members accepts_nested_attributes_for :meeting_has_members accepts_nested_attributes_for :meetings meeting.rb class Meeting < ActiveRecord::Base has_many :meeting_has_members has_many :members, through: :meeting_has_members accepts_nested_attributes_for :meeting_has_members accepts_nested_attributes_for :members meeting_has_member.rb class...

Android BufferedReader does not read the whole response

I have a problem with reading a ULR response. On Android it only reads around the half of the response. If I use the same code in a normal Java project everything works fine. try { String _output = null; URL url = new URL(""); BufferedReader buffer = new BufferedReader(new...

Sum returns value when should return 0

I'm having a really confusing problem. Here it is: [12] pry(EstimatedTime)> EstimatedTime.where(user_id:, plan_on: date).pluck(:hours) => [] [13] pry(EstimatedTime)> EstimatedTime.where(user_id:, plan_on: date).sum(:hours) => 3.0 What kind of magic is this? This statement resides in model method, that is being called from view. Before that, in controller action, i'm calling...

whenever gem not working, Rails 4

I am using Whenever gem to schedule some work on my site. Currently I am working on development environment. I have instaled gem as guide suggests. In schedule.rb every 2.minutes do rake "vip_recomend:give" end In lib/tasks/vip_recomend.rake namespace :vip_recomend do desc "Give vip recomend to ads that are in waiting list"...

FullCalendar event directing to wrong url

So I have set up FullCalendar to my site. I used this tutorial. Everything works fine except the urls I add to events on my calendar. So when I've added a URL to an event it should direct me to that url when I press on the event. For example,...

Hide label in certain resolution with simple_form

I have this wrapper in simple_forms config.wrappers :styled_horizontal_boolean3, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| b.use :html5 b.optional :readonly b.use :label, class: 'hidden-sm hidden-xs col-md-3 control-label' b.wrapper tag: 'div', class: 'col-md-9 checkbox-margin' do |wr| wr.wrapper tag: 'div', class: 'styled checkbox' do |ba| ba.use :label_span_input, class: 'col-md-9', span_class: 'left' end...

What is wrong with this Google Elevation API URL?

I am making an application using mainly Python to find the most fuel efficient route using primarily Google Maps data. I have been using the Encoded Polyline Algorithm to get elevation data, as well as a small Python module for the conversions. Normally, the conversion from LatLngs into polyline works...

Coinbase Oauth2 - token request URL - “404 Not found”

First steps of the Coinbase Oauth Authorization seem to work fine. I request the customer code via the following URL: "" I get back the code via URL.. Then trying to request the token with given CODE and CLIENT SECRET and CLIENT ID:...