##References
##Create Rails App
command to make new directory:
mkdir AppName
##References
##Create Rails App
command to make new directory:
mkdir AppName
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.
| // SASS variable overrides must be declared before loading up Active Admin's styles. | |
| // | |
| // To view the variables that Active Admin provides, take a look at | |
| // `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the | |
| // Active Admin source. | |
| // | |
| // For example, to change the sidebar width: | |
| // $sidebar-width: 242px; | |
| // Active Admin's got SASS! |
| #!/usr/bin/ruby | |
| require 'rss' | |
| # Usage | |
| # $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
| # episodes.rss | |
| # OR | |
| # $ ./railscasts.rb | |
| p 'Downloading rss index' |
In your view:
<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>In your controller:
respond_to :html, :js, only: [:index]
def index| # encoding: utf-8 | |
| # Be sure to restart your server when you modify this file. | |
| # Add new inflection rules using the following format | |
| # (all these examples are active by default): | |
| # ActiveSupport::Inflector.inflections do |inflect| | |
| # inflect.plural /^(ox)$/i, '\1en' | |
| # inflect.singular /^(ox)en/i, '\1' | |
| # inflect.irregular 'person', 'people' | |
| # inflect.uncountable %w( fish sheep ) |
| Router.map(function () { | |
| this.route('index', { | |
| controller: 'BasicController', | |
| layoutTemplate: 'indexLayout', | |
| path: '/', | |
| waitOn: function () { | |
| return Meteor.subscribe('Channels'); | |
| } | |
| }); |
Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
Install XQuartz
Install meld with brew
brew install meld
Copy PYTHONPATH
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |