Search Results

Search found 8586 results on 344 pages for 'rails vim'.

Page 10/344 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Rails :Is this caching problem

    - by Ankit
    Hi, I'm new to rails, and have taken some existing site for new enhancements. I mirrored rails application from remote server, and running locally using "ruby script/server" server. The problem is any changes to the files are not being reflected in web browser. Is this because of caching somehwere. Can someone pls point me where should Ilook to disable this or come back to development env?

    Read the article

  • Annotate gem and rails 3.1

    - by vincent jacquel
    Does anyone have any idea why annotate does not work anymore in rails 3.1 ? When trying to run it with : $ rvmsudo bundle exec annotate --position before and given I've got the following in my gemfile: gem "annotate", '2.4.0' I get the following error: /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0/lib/active_record /railties/databases.rake:3:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError) I'm using RVM with a gemset dedicated to rails 3.1 with Ruby 1.9.2

    Read the article

  • :any option for rails 3 routes

    - by user357523
    In rails 2 you can use the :any option to define a custom route that responds to any request method e.g. map.resources :items, :member => {:erase => :any} rails 3 doesn't seem to support the :any option resources :items do get :erase, :on => :member # works any :erase, :on => :member # doesn't work end does anyone know if this option has been removed or just renamed?

    Read the article

  • How to evaluate the quality of Rails code?

    - by Fortuity
    In a code review, what do you look for to assess a developer's expertise? Given an opportunity to look at a developer's work on a real-world project, what tell-tale signs are a tip-off to carelessness or lack of experience? Conversely, where do you look in the code to find evidence of a developer's skill or knowledge of best practices? For example, if I'm looking at a typical Rails app, I would be happy to see the developer is using RSpec (showing a commitment to using test-driven development and knowledge that RSpec is currently more popular than the default TestUnit). But in examining the specs for a Rails model, I see that the developer is testing associations, which might indicate a lack of real understanding of Rails testing requirements (since such tests are redundant given that they only test what's already implemented and tested in ActiveRecord). More generally, I might look to see if developers are writing their own implementations versus using widely available gems or if they are cleaning up code versus leaving lots of commented-out "leftovers." What helps you determine the skill of a Rails developer? What's your code quality checklist?

    Read the article

  • How to evaluate the quality of Rails code?

    - by Fortuity
    In a code review, what do you look for to assess a developer's expertise? Given an opportunity to look at a developer's work on a real-world project, what tell-tale signs are a tip-off to carelessness or lack of experience? Conversely, where do you look in the code to find evidence of a developer's skill or knowledge of best practices? For example, if I'm looking at a typical Rails app, I would be happy to see the developer is using RSpec (showing a commitment to using test-driven development and knowledge that RSpec is currently more popular than the default TestUnit). But in examining the specs for a Rails model, I see that the developer is testing associations, which might indicate a lack of real understanding of Rails testing requirements (since such tests are redundant given that they only test what's already implemented and tested in ActiveRecord). More generally, I might look to see if developers are writing their own implementations versus using widely available gems or if they are cleaning up code versus leaving lots of commented-out "leftovers." What helps you determine the skill of a Rails developer? What's your code quality checklist?

    Read the article

  • Custom field names in Rails error messages

    - by Madhan ayyasamy
    The defaults in Rails with ActiveRecord is beautiful when you are just getting started and are created everything for the first time. But once you get into it and your database schema becomes a little more solidified, the things that would have been easy to do by relying on the conventions of Rails require a little bit more work.In my case, I had a form where there was a database column named “num_guests”, representing the number of guests. When the field fails to pass validation, the error messages is something likeNum guests is not a numberNot quite the text that we want. It would be better if it saidNumber of guests is not a numberAfter doing a little bit of digging, I found the human_attribute_name method. You can override this method in your model class to provide alternative names for fields. To change our error message, I did the followingclass Reservation ... validates_presence_of :num_guests ... HUMAN_ATTRIBUTES = { :num_guests = "Number of guests" } def self.human_attribute_name(attr) HUMAN_ATTRIBUTES[attr.to_sym] || super endendSince Rails 2.2, this method is used to support internationalization (i18n). Looking at it, it reminds me of Java’s Resource Bundles and Spring MVC’s error messages. Messages are defined based off a key and there’s a chain of look ups that get applied to resolve an error’s message.Although, I don’t see myself doing any i18n work in the near-term, it is cool that we have that option now in Rails.

    Read the article

  • Connect Rails model to non-rails database

    - by the_snitch
    I'm creating a new web application (Rails 3 beta), of which pieces of it will access data from a legacy mysql database that a current php application is using. I do not wish to modify the legacy db schema, I just want to be able to read/write to it, as well as the rails application having it's own database using activerecord for the newer stuff. I'm using mysql for the rails app, so I have the adapter installed. How is the best way to do this? For example, I want contacts to come from the old database. Should I create a contacts controller, and manually call sql to get the variables for the views? Or should I create a Contact model, and define attributes that match the fields in the database, and am I able to use it like Contact.mail_address to have it call "SELECT mailaddr FROM contacts WHERE id=Contact.id". Sorry, I've never done much in Rails outside of the standard stuff that is documented well. I'm not sure of what the best approach would be. Ideally, I want the contacts to be presented to my rails application as native as possible, so that I can expose them RESTfully for API access. Any suggestions and code examples would be much appreciated

    Read the article

  • vim does not preserve symlink over sshfs

    - by HighCommander4
    I'm having some trouble with symlinks and sshfs. I use the '-o follow_symlinks' option to follow symlinks on the server side, but whenever I edit a symlinked file on the client side with vim, a copy of it is made on the server side, i.e. it's no longer a symlink. Set up a symlink on the server side: me@machine1:~$ echo foo > test.txt me@machine1:~$ mkdir test me@machine1:~$ cd test me@machine1:~/test$ ln -s ../test.txt test.txt me@machine1:~/test$ ls -al test.txt lrwxrwxrwx 1 me me 11 Jan 5 21:13 test.txt -> ../test.txt me@machine1:~/test$ cat test.txt foo me@machine1:~/test$ cat ../test.txt foo So far so good. Now: me@machine2:~$ mkdir test me@machine2:~$ sshfs me@machine1:test test -o follow_symlinks me@machine2:~$ cd test me@machine2:~/test$ vim test.txt [in vim, add a new line "bar" to the file] me@machine2:~/test$ cat test.txt foo bar Now observe what this does to the file on the server side: me@machine1:~/test$ ls -al test.txt -rw-r--r-- 1 me me 19 Jan 5 21:24 test.txt me@machine1:~/test$ cat test.txt foo bar me@machine1:~/test$ cat ../test.txt foo As you can see, it made a copy and only edited the copy. How can I get it to work so it actually follows the symlink when editing the file?

    Read the article

  • Too Few Arguments

    - by NoahClark
    I am trying to get some Javascript working in my Rails app. I want to have my index page allow me to edit individual items on the index page, and then reload the index page upon edit. My index.html.erb page looks like: <div id="index"> <%= render 'index' %> </div> In my index.js.erb I have: $('#index').html("<%=j render 'index' %>"); and in my holders_controller: def edit holder = Holder.find(params[:id]) end def update @holder = Holder.find(params[:id]) if @holder.update_attributes(params[:holder]) format.html { redirect_to holders_path } #, flash[:success] = "holder updated") ## ^---Line 28 in error format.js else render 'edit' end end When I load the index page it is fine. As soon as click the edit button and it submits the form, I get the following: But if I go back and refresh the index page, the edits are saved. What am I doing wrong?

    Read the article

  • Vim: How to handle newlines when storing multiple commands in registers?

    - by UncleZeiv
    I have a file where I store snippets of vim commands. When I need a snippet, I yank it and then execute it with @". The snippets are stored as a script, one line per command, like this: :s/foo/bar/g :echo "hello" :s/1/2/g Edit: I removed normal mode commands from the example, as they were not part of the problem. Now this procedure doesn't work anymore: when executing the snippet, it just stops at the first line as if waiting for a newline. Is there an option somewhere affecting how @ is executed? I'm pretty sure it was working some time ago... Substituting the newline with a ^M character works but makes the file more difficult to handle. Additional information: Here's another symptom: when I yank a snippet, if I execute it with @" it stops at the first line as I just explained. But if I execute it with :@ it works. But the help file doesn't seem to imply any difference in how the two commands treat the register's content...

    Read the article

  • Rails 3 memory issue

    - by Erik
    Hello! I'm developing a new site based on Ruby on Rails 3 beta. I knew this might be a bad idea considering it's just beta, but I still thought it might work. Now though I'm having HUGE problems with Rails consuming huge ammounts of memory. For my application today it consumes about 10 mb per request and it doesn't seem to release it either. So I thought this might be because of bloat in my application and thus I created a test app just to compare. For my test app I just generated a model with a scaffold and then created about 20 records on this model. I then went to the index page and hit refresh and I could immediately see memory taking off! Less than my app but still about 1-3 mb per request. I'm working in OSX Leopard, with Ruby 1.8.7, Rails 3.0.0.beta and a SQLLite db for development. Does anyone recognize my problem? I would really appreciate some help here. :/ Thanks!

    Read the article

  • Ruby on Rails controller and architecture with cells

    - by dt
    I decided to try to use the cells plugin from rails: http://cells.rubyforge.org/community.html given that I'm new to Ruby and very used to thinking in terms of components. Since I'm developing the app piecemeal and then putting it together piece by piece, it makes sense to think in terms of components. So, I've been able to get cells working properly inside a single view, which calls a partial. Now, what I would like to be able to do (however, maybe my instincts need to be redirected to be more "Rails-y"), is call a single cell controller and use the parameters to render one output vs. another. Basically, if there were a controller like: def index params[:responsetype] end def processListResponse end def processSearchResponse end And I have two different controller methods that I want to respond to based on the params response type, where I have a single template on the front end and want the inner "component" to render differently depending on what type of request is made. That allows me to reuse the same front-end code. I suppose I could do this with an ajax call instead and just have it rerender the component on the front end, but it would be nice to have the option to do it either way and to understand how to architect Rails a bit better in the process. It seems like there should be a "render" option from within the cells framework to render to a certain controller or view, but it's not working like I expect and I don't know if I'm even in the ballpark. Thanks!

    Read the article

  • What is a practical way to debug Rails?

    - by Joshua Fox
    I get the impression that in practice, debuggers are rarely used for Rails applications. (Likewise for other Ruby apps, as well as Python.) We can compare this to the usual practice for Java or VisualStudio programmers--they use an interactive debugger in a graphical IDE. How do people debug Rails applications in practice? I am aware of the variety of debuggers, so no need to mention those, but do serious Rails programmers work without them? If so, why do you choose to do it this way? It seems to me that console printing has its limits when debugging complex logic.

    Read the article

  • Switching CSS to use asset pipeline in Rails?

    - by John
    I have a lot of legacy CSS files from what was a Rails 2.x app that got upgraded to Rails 3.2.8, and I want to switch over to using the Rails asset pipeline for stylesheets. The issue is, the CSS stuff is messy in terms of huge lines of code, duplicate file names, and unorganized folder structure. After looking through individual pages, and trying to add individual stylesheets and folders into the asset pipeline and spending some cycles debugging, I realized there's probably a better approach. Is there a way to test to make sure the old CSS matches up with the asset pipeline CSS? What are some good tools for testing and debugging CSS?

    Read the article

  • Text Editor with SSH/Terminal/FTP/Putty combo for develeping in Rails on Windows

    - by Panoy
    I plan to learn Ruby on Rails and would like to code in my development box which runs on Windows XP. I have Ubuntu Server (forgot the version ;p) running as my web server with Rails installed on it. I have been considering using Vim as my text editor of choice in XP but would like to know any text editor and accompanying shell/FTP/Putty/SSH (or whatever you may call it) program that can access those files in my Ubuntu server. It is better if the shell can be called or is bundled inside the text editor. I would like to know your combinations (text editor + shell) and your experiences on it when you were able to develop your Rails projects on that combination. Cheers!

    Read the article

  • Web Host for Small Rails-based CMS site [closed]

    - by clem
    Possible Duplicate: How to find web hosting that meets my requirements? I am building a site for someone that uses a Rails-based content management system that I built myself. All of the Rails deployment experience I have so far has been over small intranets. I'm looking at web hosts like rackspace, because it seems like they're well-suited for Rails deployment. However, for a site that's not going to have more than a couple of hundred hits a month (if even that), I'm not sure it's necessary. I've also used Dreamhost's Phusion Passenger deployment for small projects before, but it seems barely functional and not well-supported, and I've also used Heroku for deployment, but I think a regular web host may do a little bit better, as they'll need things like Google Apps for Gmail set up. If anyone could provide some guidance on this, I'd greatly appreciate it. I get confused when I see things on rackspace like "1.5c/hour", because I'm not sure how that gets computed.

    Read the article

  • What is Rails way to save images?

    - by user
    I develop on iOS, and I'm switching from a PHP backend to Ruby on Rails. The interchange format is JSON. A quick Google search for 'save images in Rails' has nearly every result talking about saving image data as blobs to the database. I might be mistaken, but I'm under the impression that saving image data in a database is a huge waste of time and space (as opposed to saving a link to the file location ('/img/subcat/4656.png'). In PHP, it's pretty standard to receive the data, generate a filename, then save that file to disk, and then update the database with the image's location on disk. Is this the same for Rails, or is there some built-in ActiveRecord image functionality I'm not aware of?

    Read the article

  • How to tell rails to use non-default ruby?

    - by Hamish Downer
    I need two different versions of ruby on a server. The packaged ruby for the packaged puppet to work, and a compiled ruby for a rails web app to work. So basically I want the default ruby to be the ruby from the package, and for rails to use the compiled ruby (in /usr/local/bin/ and /usr/local/lib/ ) I've found references to setting the RUBYPATH and RUBYLIB environment variables, but I'm confused as to where to set them. In .bashrc, .profile, in the apache config somewhere?

    Read the article

  • environment change in rake task

    - by Mellon
    I am developing Rails v2.3 app with MySQL database and mysql2 gem. I faced a weird situation which is about changing the environment in rake task. (all my setting and configurations for environment and database are correct, no problem for that.) Here is my simple story : I have a rake task like following: namespace :db do task :do_something => :environment do #1. run under 'development' environment my_helper.run_under_development_env #2. change to 'custom' environment RAILS_ENV='custom' Rake::Task['db:create'] Rake::Task['db:migrate'] #3. change back to 'development' environment RAILS_ENV='development' #4. But it still run in 'customer' environment, why? my_helper.run_under_development_env end end The rake task is quite simple, what it does is: 1. Firstly, run a method from my_helper under "development" environment 2. Then, change to "custom" environment and run db:create and db:migrate until now, everything is fine, the environment did change to "custom" 3. Then, change it back again to "development" environment 4. run helper method again under "development" environment But, though I have changed the environment back to "development" in step 3, the last method still run in "custom" environment, why? and how to get rid of it? --- P.S. --- I have also checked a post with the similar situation here, and tried to use the solution there like (in step 2): ActiveRecord::Base.establish_connection('custom') Rake::Task['db:create'] Rake::Task['db:migrate'] to change the database connection instead of changing environment but, the db:create and db:migrate will still run under "development" database, though the linked post said it should run for "custom" database... weird

    Read the article

  • Problems installing rails on Ubuntu 12.04. Rails gems library is empty

    - by Woho87
    I got some problem installing rails on Ubuntu 12.04. I have rails working on my Ubuntu for a little time. But for some reason I uninstall rails. When I decided to install it again with sudo gem install rails . The command rails -v doesn't work. When I run the command sudo gem install rails there is no error occurring just a message that saying: Successfully installed rails-3.2.6 I look at the folder /usr/lib/ruby/gems/1.8/gems/rails-3.2.6 and it is completely empty? I wonder how I can fix this problem?

    Read the article

  • Bash alias to open Vim at last edit mark

    - by Pierre LaFayette
    The mark " in Vim takes you to your last edit position. I want to create an alias that will open my Vim instance and jump to that mark; something which is obviously extremely useful. This works from the command line: $ vim -c "'\"" File.cpp Now I want to make an alias for this: $ alias v='vim -c "'\"" File.cpp' Well that's not going to work! You need to escape the first single quote you say... $ alias v='vim -c "\'\"" File.cpp' Hmm. That didn't work either... So I try a whole lot of variations of single quoted and double quoted madness, bang my head against the table and load up stackoverflow in my browser, and here we are. How do I properly escape this alias?

    Read the article

  • Bash alias to open Vim at last cursor position mark

    - by Pierre LaFayette
    The mark " in Vim takes you to your last cursor position. I want to create an alias that will open my Vim instance and jump to that mark; something which is obviously extremely useful. This works from the command line: $ vim -c "'\"" File.cpp Now I want to make an alias for this: $ alias v='vim -c "'\""' Well that's not going to work! You need to escape the first single quote you say... $ alias v='vim -c "\'\""' Hmm. That didn't work either... So I try a whole lot of variations of single quoted and double quoted madness, bang my head against the table and load up stackoverflow in my browser, and here we are. How do I properly escape this alias?

    Read the article

  • how to manage vim plugin

    - by Haiyuan Zhang
    I want to know how do you manage your vim plugins. As it is, One of the biggest fun of using is that one can easily try many interesing new plugins, just download it and unzip it in under ~/.vim. But if you try too often and try too much, you might get trouble as confilct of key mapping , in compatitble script version, dpendency between different plugin ..... Then you want to remove some plugin ,kind of like rollback your vim to a sound condition. But, the rollback could be very painful . cus for some "giant" plugin, like perl-support ( it's great plugin, anyway), will consist of many vim scripts which spread in different dirctories. To remove single one giant plugin will be anoying, not too mention if you remvoe many plugin at one time. In a word , I'm looking for good practice for managing vim plugins.

    Read the article

  • Programmatically execute vim commands?

    - by Ben Gartner
    I'm interested in setting up a TDD environment for developing Vim scripts and rc files. As a simple example, say I want to have vim insert 8 spaces when I press the tab key. I would set up a script that did the following: Launch vim using a sandboxed .vimrc file press i press tab press esc press :w test_out assert that test_out contains ' ' by the default config in vim, this would fail. However, once I add set expandtab to my .vimrc file, the test will pass. So the question is, how do I programmatically issue these commands? 'vim -c ' is close, but seems to only work for ex mode commands. Any suggestions? This question seem to be thoroughly google-proof.

    Read the article

  • Errors detected when loading a vim plugin from .vimrc

    - by Tejinder
    I have installed vim 7.3 on debian system along with some vimrc i have downloaded from internet. It used to work fine on my other debian machine but here i get these error messages while i load the vim editor. Here are the errors: Error detected while processing /home/tejinder/.vim/plugin/gundo.vim: line 196: E319: Sorry, the command is not available in this version: python << ENDPYTHON line 197: E492: Not an editor command: def asciiedges(seen, rev, parents): line 199: E121: Undefined variable: rev E15: Invalid expression: rev not in seen: line 221: E133: :return not inside a function line 231: E133: :return not inside a function line 233: E133: :return not inside a function line 235: E133: :return not inside a function line 238: E690: Missing "in" after :for line 347: E690: Missing "in" after :for line 356: E690: Missing "in" after :for line 453: E690: Missing "in" after :for line 464: E690: Missing "in" after :for line 469: E133: :return not inside a function line 795: E170: Missing :endfor Press ENTER or type command to continue If anyone could figure out thats going on, please guide me. Thanks a lot. Here is vimrc source: https://github.com/mitsuhiko/dotfiles/tree/master/vim

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >