ruby-on-rails-3

Rails 3 - Help with a Email Validation Regex

不想你离开。 提交于 2019-12-25 06:36:10
问题 the following REGEX if provided an email domain that does not match INVALID_EMAILs seems to run indefinitely and lock up the rails server (my local env). INVALID_EMAILS = %w(gmail.com googlemail.com yahoo.com ymail.com rocketmail.com hotmail.com facebook.com) def valid_email_domain(emailAddy) reg = Regexp.new /#{User::INVALID_EMAILS.map{|a| Regexp.quote(a)}.join("|")}/ if emailAddy.scan(reg).size == 0 return true else return false end end Any regex experts out there that can provide feedback?

Rails 3 - Help with a Email Validation Regex

ε祈祈猫儿з 提交于 2019-12-25 06:35:13
问题 the following REGEX if provided an email domain that does not match INVALID_EMAILs seems to run indefinitely and lock up the rails server (my local env). INVALID_EMAILS = %w(gmail.com googlemail.com yahoo.com ymail.com rocketmail.com hotmail.com facebook.com) def valid_email_domain(emailAddy) reg = Regexp.new /#{User::INVALID_EMAILS.map{|a| Regexp.quote(a)}.join("|")}/ if emailAddy.scan(reg).size == 0 return true else return false end end Any regex experts out there that can provide feedback?

Best way to customize my site when viewed through iframes?

北城余情 提交于 2019-12-25 06:23:22
问题 I have a site where users need to access our material in two ways: from the site itself from iframes embedded into another site My site handles #1 very nicely, and now I'm trying to extend its functionality to iframes that can be easily embedded. Essentially, I need to get rid of the site header, the site footer, and change some CSS for every page that is shown through an iframe (users need to be able to navigate quite a few pages using this iframe). When trying the <iframe> tag, I get my

Rails Gem::LoadError in UsersController#new

时光毁灭记忆、已成空白 提交于 2019-12-25 06:11:28
问题 New to Ruby on Rails and having a problem when following Michael Hartl's tutorial.I'm using Rails 3.2.2 with Ruby 1.9.3. The issue looks very similar to another question that was raised but was unanswered: Rails Error NoMethodError in UsersController#show error I get the following error when attempting to add a new user via /signup Gem::LoadError in UsersController#new bcrypt-ruby is not part of the bundle. Add it to Gemfile. Reloading the page gives the error: NoMethodError in

How can i add values for a field from another model in rails?

Deadly 提交于 2019-12-25 05:55:30
问题 I have a user model and language model where the language model contains list of languages and the user model contains the information of the user. In user model there is a field called language where the user should select a language from the language model. And for all these i do not have form and i want to pass the id of the language when creating new user and it should save the language for the user. I use curl to create and update. So please tell me how i can do this? Please help me.

How to localize a generic error messages partial in Rails 3.2.3?

£可爱£侵袭症+ 提交于 2019-12-25 05:51:39
问题 I am using the following partial to display error messages for most of my models in Rails 3.2.3: # _error_messages.html.erb <% if object.errors.any? %> <div id="error_explanation"> <h3><%= pluralize(object.errors.count, "error") %> prohibited this <%= object.class.to_s.underscore.humanize.downcase %> from being saved:</h3> <p>There were problems with the following fields:</p> <ul> <% object.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> This worked

Rich text formatting (RTF) editor plugins for Rails 3 and jQuery website? [closed]

若如初见. 提交于 2019-12-25 05:38:10
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Which RTF editor do you use? We're on Rails 3 and jQuery and looking to implement a low-maintenance RTF editor. We prefer to use a

'nil' is not an ActiveModel-compatible object that returns a valid partial path

两盒软妹~` 提交于 2019-12-25 05:25:54
问题 First question, please be gentle :) I am having trouble creating an index view for a client model that belongs_to the user model with a has_many association. The error message: 'nil' is not an ActiveModel-compatible object that returns a valid partial path. Specifically the error refers to the partial on line #11: /views/clients/index.html <% provide(:title, current_user.name) %> <div class="row"> <aside class="span4"> <section> <h1>Your clients</h1> </section> </aside> <div class="span8"> <%

Rails 3 - Before form submission human check

社会主义新天地 提交于 2019-12-25 05:25:19
问题 I've got a simple message form (:name, :title, :body) that has a recaptcha. When I have both my form and recaptcha on the same page I don't get the same user experience because my server-side form model validations don't work like i'd like them to. So I was thinking of implementing a redirect to a seperate recaptcha page before the form attributes get saved into my database. I was wondering what are the best practices for this situation? Should I send a session of the message attributes to

How can I call a controller action based on combo box?

拟墨画扇 提交于 2019-12-25 05:21:36
问题 I am using Ruby on Rails 3.2.2 and ruby 1.9 . I do have a model tender and one of the attributes is status. On the index page, the first time it is loaded, it displays the tender data based on the user's company who already logged in (it will also display the status). I want to have a filter by combo box which will contain all the statuses (Initiated, Closed, Won ..etc )so when the user changes the filter by, I want to change the table data as well by submitting the status to a controller