Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| class Klass | |
| def initialize(number) | |
| self.number = number | |
| end | |
| attr_reader :number | |
| private | |
| attr_writer :number |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| # config/initializers/clear_dev_logs.rb | |
| # This snippet simply clears your logs when they are too large. | |
| # Large logs for development are usually something you don't want. | |
| # Every time you run rails server or rails console it checks the size | |
| # of your development logfile and truncates it. | |
| if Rails.env.development? | |
| MAX_LOG_SIZE = 1.megabytes | |
| DEV_LOG_FILE = File.join(Rails.root, 'log', 'development.log') |
| # Copy and paste this to the rails console to test your email settings | |
| # Rails 3.2 | |
| class TestMailer < ActionMailer::Base | |
| default :from => "[email protected]" | |
| def welcome_email | |
| mail(:to => "[email protected]", :subject => "Test mail", :body => "Test mail body") | |
| end |
| # _children.html.erb | |
| <%= content_tag :ol, raw(children) %> | |
| # _controls.html.erb | |
| <%- | |
| edit = link_to '', polymorphic_url(opts[:namespace] + [node], :action => :edit), :title => t('.edit_this'), :class => 'button edit' | |
| if opts[:has_children] | |
| delete = link_to('', url_for(opts[:namespace] + [node]), | |
| :title => t('.delete'), | |
| :method => :delete, |
Steps to follow, Ref:
bundle installrails g rspec:install.rspec| it: | |
| errors: | |
| messages: | |
| not_found: "non trovato" | |
| already_confirmed: "è stato già confermato" | |
| not_locked: "non era bloccato" | |
| devise: | |
| failure: | |
| unauthenticated: "Devi accedere o registrarti per continuare." |
| namespace :heroku do | |
| desc "Generate the Heroku gems manifest from gem dependencies" | |
| task :gems do | |
| RAILS_ENV='production' | |
| Rake::Task[:environment].invoke | |
| list = Rails.configuration.gems.collect do |g| | |
| command, *options = g.send(:install_command) | |
| options.join(" ") + "\n" | |
| end | |