This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= nested_form_for @tecnico do |f| %> | |
<% if @tecnico.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@tecnico.errors.count, "error") %> prohibited this tecnico from being saved:</h2> | |
<ul> | |
<% @tecnico.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 class Api::V1::RegionsController < Api::V1::BaseController | |
2 | |
3 def index | |
4 respond_with(Region.all) | |
5 end | |
6 end | |
1 class Api::V1::BaseController < ActionController::Base | |
2 respond_to :json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want @holidays to contain all the holidays of a specific regions. | |
def by_region_id | |
@holidays | |
Region.find(params[:region_id]).countries.each do |country|. | |
@holidays = country.holidays | |
end end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError in Api::V1::HolidaysController#by_region_id | |
undefined method `map' for #<Api::V1::HolidaysController:0x007f881058ee50> | |
Rails.root: /home/lurraca/projects/holidays_in | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/api/v1/holidays_controller.rb:17:in `block in by_region_id' | |
app/controllers/api/v1/holidays_controller.rb:17:in `each' | |
app/controllers/api/v1/holidays_controller.rb:17:in `by_region_id' | |
Request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def by_region_id | |
@holidays = {} | |
Region.find(params[:region_id]).countries.all.each{|r| @holidays[:r] = map(&:holidays)} | |
r.map(&:holidays) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en jurisdom/config/routes.rb tengo: | |
namespace :refinery do | |
post '/newsletter/subscribe/:email' => 'refinery/pages#add_email' | |
end | |
============================================================================================================== | |
Este es el metodo que voy a utilizar en el controller pa agrega el email a la db, pero no se en cual controller lo voy a poner. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, target-densityDpi=device-dpi" /> | |
<title>Cordova</title> | |
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script> | |
<link rel="stylesheet" type="text/css" href="css/style.css" /> | |
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.css" /> | |
<script src="javascript/jquery.js"></script> | |
<script src="javascript/jquery.mobile-1.1.0.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i would like to create a <li> element with the name from json object for each object available in the response. | |
[ | |
{ | |
created_at: "2012-06-01T01:19:20Z", | |
id: 1, | |
name: "Sto Dgo", | |
updated_at: "2012-06-01T01:19:20Z" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Cines</title> | |
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" media="all"> | |
<link rel="stylesheet" href="stylesheets/jquery.mobile-1.1.0.min.css" /> | |
<script src="jquery-1.7.2.min.js"></script> | |
<script src="jquery.mobile-1.1.0.min.js"></script> | |
<script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://23.21.128.153:3000/regions.json";var jsonresults; | |
$.getJSON(url,function(data){ | |
jsonresults = data; | |
$('#main-content').append('<div data-role="navbar"><ul>'); | |
$.each(jsonresults, function(i,v){ | |
$('#main-content').append('<li><a href="a.html">'+jsonresults[i].name+'</a></li>'); | |
}); | |
$('#main-content').append('</ul></div>'); |
OlderNewer